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

chore: default authenticated 적용 #240

Merged
merged 10 commits into from
Jan 12, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ public AuthenticationManager authenticationManager(AuthenticationConfiguration a
@Bean
public SecurityFilterChain securityFilterChainPermitAll(HttpSecurity http) throws Exception {
configureCommonSecuritySettings(http);
http
.securityMatchers(matchers -> matchers
.requestMatchers(requestPermitAll())
)
.authorizeHttpRequests().anyRequest().permitAll();
http.securityMatchers(matchers -> matchers.requestMatchers(requestPermitAll()))
.authorizeHttpRequests()
.anyRequest()
.permitAll();
return http.build();
}

Expand Down Expand Up @@ -163,8 +162,7 @@ public FilterRegistrationBean<JwtAuthenticationFilter> filterRegistration(JwtAut
}

private RequestMatcher[] requestHasRoleSuperAdmin() {
List<RequestMatcher> requestMatchers = List.of(
antMatcher("/api/*/admin/management/**"));
List<RequestMatcher> requestMatchers = List.of(antMatcher("/api/*/admin/management/**"));
return requestMatchers.toArray(RequestMatcher[]::new);
}

Expand Down Expand Up @@ -224,15 +222,14 @@ private RequestMatcher[] requestHasRoleUser() {
@Bean
public SecurityFilterChain securityFilterChainDefault(HttpSecurity http) throws Exception {
configureCommonSecuritySettings(http);
http
.authorizeHttpRequests()
.anyRequest().permitAll();
// .and()
// .addFilterAfter(jwtAuthenticationFilter, ExceptionTranslationFilter.class)
// .exceptionHandling(exception -> {
// exception.authenticationEntryPoint(jwtAuthenticationEntryPoint);
// exception.accessDeniedHandler(jwtAccessDeniedHandler);
// });
http.authorizeHttpRequests()
.anyRequest().authenticated()
.and()
.addFilterAfter(jwtAuthenticationFilter, ExceptionTranslationFilter.class)
.exceptionHandling(exception -> {
exception.authenticationEntryPoint(jwtAuthenticationEntryPoint);
exception.accessDeniedHandler(jwtAccessDeniedHandler);
});
return http.build();
}

Expand Down