File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/main/java/targeter/aim/system/configuration Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 33import io .swagger .v3 .oas .models .Components ;
44import io .swagger .v3 .oas .models .OpenAPI ;
55import 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 ;
68import io .swagger .v3 .oas .models .servers .Server ;
79import org .springframework .context .annotation .Bean ;
810import org .springframework .context .annotation .Configuration ;
911
1012@ Configuration
1113public class SwaggerConfig {
1214
15+ private static final String JWT_SCHEME_NAME = "JWT Auth" ;
16+
1317 @ Bean
1418 public OpenAPI openAPI () {
1519 Info info = new Info ()
1620 .title ("Aim API Document" )
1721 .version ("v0.0.1" )
1822 .description ("Aim의 API 명세서입니다." );
1923
24+ SecurityScheme securityScheme = new SecurityScheme ()
25+ .type (SecurityScheme .Type .HTTP )
26+ .scheme ("bearer" )
27+ .bearerFormat ("JWT" )
28+ .in (SecurityScheme .In .HEADER )
29+ .name ("Authorization" );
30+
31+ SecurityRequirement securityRequirement = new SecurityRequirement ()
32+ .addList (JWT_SCHEME_NAME );
33+
2034 return new OpenAPI ()
21- .components (new Components ())
35+ .components (new Components ()
36+ .addSecuritySchemes (JWT_SCHEME_NAME , securityScheme ))
37+ .addSecurityItem (securityRequirement )
2238 .addServersItem (new Server ().url ("/" ))
2339 .info (info );
2440 }
You can’t perform that action at this time.
0 commit comments