Skip to content

Commit

Permalink
�chore: default authenticated 적용 (#240)
Browse files Browse the repository at this point in the history
* chore: http Authorization 헤더 추가

* docs: ddl 컬럼 크기 변경

* docs: 컨트롤러 스웨거 추가

* chore: swagger 권한 설정

* chore: permitAll 로 임시 변경

* chore: swagger, h2-console 권한 변경, x-frame-options disable

* chore: default authenticated
  • Loading branch information
eunbc committed Jan 12, 2024
1 parent f00cb1e commit 40d7e1d
Showing 1 changed file with 13 additions and 16 deletions.
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

0 comments on commit 40d7e1d

Please sign in to comment.