Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chapter 08] 회원가입후 로그인시 교재의 화면으로 이동하지 않고 "Whitelabel Error Page" 가 표시됨 #63

Open
colinkim opened this issue May 23, 2024 · 1 comment

Comments

@colinkim
Copy link

안녕하세요
교재의 챕터 08장을 공부 중에 궁금한 사항이 있어서 문의드립니다.
에러의 내용 및 자세한 동작은 아래와 같습니다.

  1. 회원가입 프로세스 진행: 정상
  2. 회원 로그인 진행: 교재의 화면이 나오지 않고 첨부 파일처럼 "Whitelabel Error Page" 로 이동합니다.
    코드에 어디에도 "continue" 로 이동하는 것이 없는 거 같이서 이해가 안되어 문의 드립니다.

제가 작업한 소스는 아래와 같으며 (제가 비교 검토한 바로는 현재 예제로 올려 놓으신 소스와 같고, 올려놓은신 코드도 동일한 에러가 발생합니다. 버전문제는 아닌거 같습니다. ㅠㅠ)
https://github.com/colinkim/springboot-dev/tree/chapter-08/springboot-dev
에러는 첨부파일 처럼 발생하네요
스크린샷 2024-05-23 오후 4 03 43
감사합니다.

@shinsunyoung
Copy link
Owner

안녕하세요. WebSecurityConfig.java 파일에서 filterChain(HttpSecurity http) 부분에서 authorizeHttpRequests를 authorizeRequests로 변경해야 합니다.

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        return http
                .**authorizeRequests**(auth -> auth
                        .requestMatchers(
                                new AntPathRequestMatcher("/login"),
                                new AntPathRequestMatcher("/signup"),
                                new AntPathRequestMatcher("/user")
                        ).permitAll()
                        .anyRequest().authenticated())
                .formLogin(formLogin -> formLogin
                        .loginPage("/login")
                        .defaultSuccessUrl("/articles")
                )
                .logout(logout -> logout
                        .logoutSuccessUrl("/login")
                        .invalidateHttpSession(true)
                )
                .csrf(AbstractHttpConfigurer::disable)
                .build();
    }


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants