-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38e3dca
commit 75cc74e
Showing
1 changed file
with
38 additions
and
38 deletions.
There are no files selected for viewing
76 changes: 38 additions & 38 deletions
76
src/main/java/com/nawabali/nawabali/config/SwaggerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
package com.nawabali.nawabali.config; | ||
|
||
|
||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
import io.swagger.v3.oas.models.security.SecurityScheme; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
@Bean | ||
public OpenAPI openAPI() { | ||
String jwt = "JWT"; | ||
SecurityRequirement securityRequirement = new SecurityRequirement().addList(jwt); | ||
Components components = new Components().addSecuritySchemes(jwt, new SecurityScheme() | ||
.name(jwt) | ||
.type(SecurityScheme.Type.HTTP) | ||
.scheme("bearer") | ||
.bearerFormat("JWT") | ||
); | ||
return new OpenAPI() | ||
.components(new Components()) | ||
.info(apiInfo()) | ||
.addSecurityItem(securityRequirement) | ||
.components(components); | ||
} | ||
private Info apiInfo() { | ||
return new Info() | ||
.title("NawaBali") // API의 제목 | ||
.description("Hanghae99 Service Launching Team 2") // API에 대한 설명 | ||
.version("1.0.0"); // API의 버전 | ||
} | ||
} | ||
|
||
|
||
//package com.nawabali.nawabali.config; | ||
// | ||
// | ||
//import io.swagger.v3.oas.models.Components; | ||
//import io.swagger.v3.oas.models.OpenAPI; | ||
//import io.swagger.v3.oas.models.info.Info; | ||
//import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
//import io.swagger.v3.oas.models.security.SecurityScheme; | ||
//import org.springframework.context.annotation.Bean; | ||
//import org.springframework.context.annotation.Configuration; | ||
// | ||
//@Configuration | ||
//public class SwaggerConfig { | ||
// @Bean | ||
// public OpenAPI openAPI() { | ||
// String jwt = "JWT"; | ||
// SecurityRequirement securityRequirement = new SecurityRequirement().addList(jwt); | ||
// Components components = new Components().addSecuritySchemes(jwt, new SecurityScheme() | ||
// .name(jwt) | ||
// .type(SecurityScheme.Type.HTTP) | ||
// .scheme("bearer") | ||
// .bearerFormat("JWT") | ||
// ); | ||
// return new OpenAPI() | ||
// .components(new Components()) | ||
// .info(apiInfo()) | ||
// .addSecurityItem(securityRequirement) | ||
// .components(components); | ||
// } | ||
// private Info apiInfo() { | ||
// return new Info() | ||
// .title("NawaBali") // API의 제목 | ||
// .description("Hanghae99 Service Launching Team 2") // API에 대한 설명 | ||
// .version("1.0.0"); // API의 버전 | ||
// } | ||
//} | ||
// | ||
// |