File tree Expand file tree Collapse file tree
src/main/java/hongik/triple/apimodule/global/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ dependencies {
1919 implementation ' org.springframework.boot:spring-boot-starter-validation'
2020
2121 // Swagger UI - spring doc
22- implementation ' org.springdoc:springdoc-openapi-ui:1.6.14 '
22+ implementation ' org.springdoc:springdoc-openapi-starter-webmvc- ui:2.8.6 '
2323
2424 // Spring Security
2525 implementation ' org.springframework.boot:spring-boot-starter-security'
Original file line number Diff line number Diff line change 1+ package hongik .triple .apimodule .global .config ;
2+
3+ import io .swagger .v3 .oas .models .Components ;
4+ import io .swagger .v3 .oas .models .OpenAPI ;
5+ import io .swagger .v3 .oas .models .info .Info ;
6+ import io .swagger .v3 .oas .models .security .SecurityRequirement ;
7+ import io .swagger .v3 .oas .models .security .SecurityScheme ;
8+ import org .springframework .context .annotation .Bean ;
9+ import org .springframework .context .annotation .Configuration ;
10+
11+ @ Configuration
12+ public class SwaggerConfig {
13+
14+ @ Bean
15+ public OpenAPI openAPI () {
16+ Info info = new Info ().title ("AcneLog Server Swagger UI" )
17+ .description ("AcneLog 서버 API 테스트 페이지입니다." )
18+ .version ("v0.0.1" );
19+
20+ String jwtSchemeName = "JWT Authentication" ;
21+ SecurityRequirement securityRequirement = new SecurityRequirement ().addList (jwtSchemeName );
22+ Components components = new Components ()
23+ .addSecuritySchemes (jwtSchemeName , new SecurityScheme ()
24+ .name (jwtSchemeName )
25+ .type (SecurityScheme .Type .HTTP )
26+ .scheme ("bearer" )
27+ .bearerFormat ("JWT" ));
28+
29+ // Swagger UI 접속 후, 딱 한 번만 accessToken을 입력해주면 모든 API에 토큰 인증 작업이 적용됩니다.
30+ return new OpenAPI ()
31+ .info (info )
32+ .addSecurityItem (securityRequirement )
33+ .components (components );
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments