|
|
|
@ -83,24 +83,25 @@ public class WebSecurityConfig { // extends WebSecurityConfigurerAdapter {
|
|
|
|
// http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
|
|
|
|
// http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
|
http.csrf(AbstractHttpConfigurer::disable)
|
|
|
|
http
|
|
|
|
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
|
|
|
.csrf(AbstractHttpConfigurer::disable)
|
|
|
|
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
|
|
|
.cors(cors -> {}) // ← CORS 설정 추가!
|
|
|
|
.authorizeHttpRequests(auth ->
|
|
|
|
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
|
|
|
auth.requestMatchers("/api/auth/**").permitAll()
|
|
|
|
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
|
|
|
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll()
|
|
|
|
.authorizeHttpRequests(auth ->
|
|
|
|
.requestMatchers("/api/test/**").permitAll()
|
|
|
|
auth.requestMatchers("/api/auth/**").permitAll()
|
|
|
|
.anyRequest().authenticated()
|
|
|
|
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll()
|
|
|
|
);
|
|
|
|
.requestMatchers("/api/test/**").permitAll()
|
|
|
|
|
|
|
|
.anyRequest().authenticated()
|
|
|
|
http.authenticationProvider(authenticationProvider());
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
|
|
|
|
http.authenticationProvider(authenticationProvider());
|
|
|
|
|
|
|
|
http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
|
|
|
|
return http.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
return http.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 임시 설정
|
|
|
|
// 임시 설정
|
|
|
|
// @Bean
|
|
|
|
// @Bean
|
|
|
|
|