반응형
간단하게 테스트해볼게있어서
새로 프로젝트를 하나 파서
후딱 외부 API 하나만 연동해올라고
스웨거 설정을 하는디
@Configuration
public class SecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll()
.anyRequest().authenticated();
return http.build();
}
}
permitAll() 해두었ㄴ느데
뭐가 문제니?
문제는~!~!~!~!
build.gradle에
implementation 'org.springdoc:springdoc-openapi-ui:1.6.15'
implementation 'org.springdoc:springdoc-openapi-data-rest:1.6.15'
implementation 'org.springdoc:springdoc-openapi-security:1.6.15'
마지막줄이 추가가 안되어있었음
의존성 주요 역할 참고
springdoc-openapi-ui | Swagger UI를 통해 API 문서를 시각화하고 테스트 가능. |
springdoc-openapi-data-rest | Spring Data REST와 통합하여 JPA 엔드포인트를 자동 문서화. |
springdoc-openapi-security | OpenAPI 문서에 인증/보안 설정 추가 (예: JWT, OAuth2). |
UI만 필요하다면 springdoc-openapi-ui만으로 충분하고
Spring Data REST 사용하는 경우: springdoc-openapi-data-rest 추가
보안이 필요한 경우: springdoc-openapi-security 추가하기 !!
반응형
'Chapter01 > Sping boot' 카테고리의 다른 글
[ 보안 취약점 ] 적절하지 않은 난수 값 사용 Math.random() (1) | 2024.12.27 |
---|---|
[node] 노드 버전 여러 개 사용하기 (5) | 2024.12.09 |
[Spring boot] 한글로된 첨부파일명이 ______ 로 다운받아질 때 (0) | 2024.11.28 |
[ Spring boot ] BCryptPasswordEncoder BCrypt 복호화 (3) | 2024.10.28 |
[ SMTP 메일 전송 ] Could not convert socket to TLS (12) | 2024.10.02 |