|
7 | 7 | import lombok.AllArgsConstructor;
|
8 | 8 | import org.springframework.context.annotation.Bean;
|
9 | 9 | import org.springframework.context.annotation.Configuration;
|
| 10 | +import org.springframework.core.annotation.Order; |
10 | 11 | import org.springframework.http.HttpMethod;
|
11 | 12 | import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
12 | 13 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
@@ -36,38 +37,38 @@ public class SecurityConfig {
|
36 | 37 | "/api/login","/swagger-ui/**","/api-docs", "/swagger-ui-custom.html",
|
37 | 38 | "/v3/api-docs/**", "/api-docs/**", "/swagger-ui.html","/api/signup","/api/mail-send",
|
38 | 39 | "/api/mail-check","/api/send-password","/api/sms-certification/send","/api/sms-certification/confirm",
|
39 |
| - "/api/find-email","/api/**", "/health-check/" |
| 40 | + "/api/find-email","/api/**", "/health-check" |
40 | 41 | };
|
41 | 42 | /*
|
42 | 43 | TODO:White List /api/** 삭제
|
43 | 44 | */
|
44 | 45 | @Bean
|
45 |
| - public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{ |
| 46 | + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { |
46 | 47 | //CSRF,CORS
|
47 | 48 | http.csrf(AbstractHttpConfigurer::disable);
|
48 | 49 | http.cors(cors -> cors.configurationSource(corsConfigurationSource()));
|
49 | 50 | //세션 관리 상태 없음 구성,
|
50 |
| - http.sessionManagement(sessionManagement->sessionManagement.sessionCreationPolicy( |
| 51 | + http.sessionManagement(sessionManagement -> sessionManagement.sessionCreationPolicy( |
51 | 52 | SessionCreationPolicy.STATELESS
|
52 | 53 | ));
|
53 | 54 |
|
54 | 55 | //FormLogin,BasicHttp 비활성화
|
55 |
| - http.formLogin((form)->form.disable()); |
| 56 | + http.formLogin((form) -> form.disable()); |
56 | 57 | http.httpBasic(AbstractHttpConfigurer::disable);
|
57 | 58 |
|
58 | 59 | //JWT Filter를 UsernamePasswordAuthenticationFilter 앞에 추가
|
59 |
| - http.addFilterBefore(new JwtAuthFilter(customMemberDetailService,jwtUtil), UsernamePasswordAuthenticationFilter.class); |
| 60 | + http.addFilterBefore(new JwtAuthFilter(customMemberDetailService, jwtUtil), UsernamePasswordAuthenticationFilter.class); |
60 | 61 |
|
61 |
| - http.exceptionHandling((exceptionHandling)->exceptionHandling |
| 62 | + http.exceptionHandling((exceptionHandling) -> exceptionHandling |
62 | 63 | .authenticationEntryPoint(customAuthenticationEntryPoint)
|
63 | 64 | .accessDeniedHandler(accessDeniedHandler));
|
64 | 65 |
|
65 | 66 | //권한 규칙 생성
|
66 |
| - http.authorizeHttpRequests(authorize->authorize |
| 67 | + http.authorizeHttpRequests(authorize -> authorize |
67 | 68 | .requestMatchers(AUTH_WHITELIST).permitAll()
|
68 | 69 | //@PreAuthorization을 사용
|
69 | 70 | //회사 관리자만 직원 삭제 가능
|
70 |
| - .requestMatchers(HttpMethod.DELETE,"/user").hasRole(MemberStatus.MANAGER.getText()) |
| 71 | + .requestMatchers(HttpMethod.DELETE, "/user").hasRole(MemberStatus.MANAGER.getText()) |
71 | 72 | .anyRequest().authenticated());
|
72 | 73 |
|
73 | 74 | return http.build();
|
|
0 commit comments