swagger 설정하기
- Security로 접근 권한을 설정 후 swagger 페이지에 정상적으로 접근이 불가능 하다.
config 수정하기
- SpringSecurityConfiguration.java
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((requests) -> requests
.requestMatchers("/api/players", "/api-docs","/swagger-ui/**", "/swagger-resources/**", "/v3/api-docs/**").authenticated()
.requestMatchers("/api/v1/team").permitAll())
.formLogin(Customizer.withDefaults())
.httpBasic(Customizer.withDefaults());
http.csrf().disable();
return http.build();
}
- 다음과 같이 swagger의 모든 경로와 접근 URL을 추가하였다.