-
Notifications
You must be signed in to change notification settings - Fork 0
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
6d66867
commit 6eb7fc8
Showing
10 changed files
with
213 additions
and
119 deletions.
There are no files selected for viewing
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
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
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
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
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
41 changes: 41 additions & 0 deletions
41
src/main/java/com/soongsil/CoffeeChat/config/swagger/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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.soongsil.CoffeeChat.config.swagger; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.HttpHeaders; | ||
|
||
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; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
@Bean | ||
public OpenAPI openAPI() { | ||
|
||
Info info = new Info() | ||
.title("COGO API 문서") | ||
.description("이상 있으면 말씀 부탁드립니다."); | ||
|
||
// Security 스키마 설정 | ||
SecurityScheme bearerAuth = new SecurityScheme() | ||
.type(SecurityScheme.Type.HTTP) | ||
.scheme("bearer") | ||
.bearerFormat("JWT") | ||
.in(SecurityScheme.In.HEADER) | ||
.name(HttpHeaders.AUTHORIZATION); | ||
|
||
// Security 요청 설정 | ||
SecurityRequirement addSecurityItem = new SecurityRequirement(); | ||
addSecurityItem.addList("JWT"); | ||
|
||
return new OpenAPI() | ||
// Security 인증 컴포넌트 설정 | ||
.components(new Components().addSecuritySchemes("JWT", bearerAuth)) | ||
// API 마다 Security 인증 컴포넌트 설정 | ||
.addSecurityItem(addSecurityItem) | ||
.info(info); | ||
} | ||
} |
Oops, something went wrong.