@@ -27,16 +27,21 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
2727 http
2828 .csrf (csrf -> csrf .disable ())
2929 .authorizeHttpRequests (auth -> auth
30+ // 비로그인 허용 경로
3031 .requestMatchers (HttpMethod .POST , "/members/signup" ).permitAll ()
3132 .requestMatchers (HttpMethod .POST , "/auth/login" ).permitAll ()
3233 .requestMatchers (HttpMethod .GET , "/members/check-email" ).permitAll ()
3334 .requestMatchers (HttpMethod .GET , "/members/check-nickname" ).permitAll ()
35+ .requestMatchers (HttpMethod .GET , "/search/**" ).permitAll ()
36+ .requestMatchers (HttpMethod .GET , "/posts/**" ).permitAll ()
37+ // h2-console (로컬 테스트용)
3438 .requestMatchers (HttpMethod .GET , "/h2-console/**" ).permitAll ()
35- //배포 확인용 임시 수정
39+ // 배포 확인용 임시 허용
3640 .requestMatchers (HttpMethod .GET , "/test" , "/test/**" ).permitAll ()
41+ // 그 외 모든 요청은 인증 필요
3742 .anyRequest ().authenticated ()
3843 )
39- .headers (headers -> headers .frameOptions (frame -> frame .disable ())) // H2 콘솔용
44+ .headers (headers -> headers .frameOptions (frame -> frame .disable ())) // H2 콘솔
4045 .addFilterBefore (jwtAuthenticationFilter (), UsernamePasswordAuthenticationFilter .class );
4146
4247 return http .build ();
@@ -52,9 +57,8 @@ public PasswordEncoder passwordEncoder() {
5257 return new BCryptPasswordEncoder ();
5358 }
5459
55- // 인증 매니저 (선택: 로그인 시 AuthenticationManager 사용 가능)
5660 @ Bean
5761 public AuthenticationManager authenticationManager (AuthenticationConfiguration config ) throws Exception {
5862 return config .getAuthenticationManager ();
5963 }
60- }
64+ }
0 commit comments