From a54d8d64ed617ebcbf98fcffddaafadb96940b47 Mon Sep 17 00:00:00 2001 From: choidongkuen Date: Sat, 13 Jan 2024 09:32:38 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20SecurityConfig=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=9E=AC=EC=A0=95=EB=A0=AC=20(#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/security/SecurityConfig.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/teumteum/core/security/SecurityConfig.java b/src/main/java/net/teumteum/core/security/SecurityConfig.java index eedd5574..d5250309 100644 --- a/src/main/java/net/teumteum/core/security/SecurityConfig.java +++ b/src/main/java/net/teumteum/core/security/SecurityConfig.java @@ -1,6 +1,8 @@ package net.teumteum.core.security; +import static org.springframework.security.config.http.SessionCreationPolicy.STATELESS; + import lombok.RequiredArgsConstructor; import net.teumteum.core.security.filter.JwtAccessDeniedHandler; import net.teumteum.core.security.filter.JwtAuthenticationEntryPoint; @@ -15,8 +17,6 @@ import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import static org.springframework.security.config.http.SessionCreationPolicy.STATELESS; - @Configuration @EnableWebSecurity @RequiredArgsConstructor @@ -34,20 +34,20 @@ public WebSecurityCustomizer webSecurityCustomizer() { @Bean SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http.csrf(AbstractHttpConfigurer::disable) - .cors(Customizer.withDefaults()) - .authorizeHttpRequests( - request -> request.requestMatchers("/**").permitAll() - .anyRequest().authenticated()) - .httpBasic(AbstractHttpConfigurer::disable) - .formLogin(AbstractHttpConfigurer::disable) - .sessionManagement(sessionManagement -> sessionManagement.sessionCreationPolicy(STATELESS)) - .exceptionHandling( - exceptionHandling -> - exceptionHandling - .authenticationEntryPoint(jwtAuthenticationEntryPoint) - .accessDeniedHandler(accessDeniedHandler) - ) - .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); + .cors(Customizer.withDefaults()) + .authorizeHttpRequests( + request -> request.requestMatchers("/**").permitAll() + .anyRequest().authenticated()) + .httpBasic(AbstractHttpConfigurer::disable) + .formLogin(AbstractHttpConfigurer::disable) + .sessionManagement(sessionManagement -> sessionManagement.sessionCreationPolicy(STATELESS)) + .exceptionHandling( + exceptionHandling -> + exceptionHandling + .authenticationEntryPoint(jwtAuthenticationEntryPoint) + .accessDeniedHandler(accessDeniedHandler) + ) + .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); return http.build(); } }