-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
`@LoginMember`가 스웨거 파라미터에 포함되지 않도록 수정. 인증 정보 입력할 수 있도록 수정
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
backend/src/main/java/mouda/backend/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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package mouda.backend.config; | ||
|
||
import org.springdoc.core.utils.SpringDocUtils; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
import io.swagger.v3.oas.models.security.SecurityScheme; | ||
import mouda.backend.config.argumentresolver.LoginMember; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
static { | ||
SpringDocUtils.getConfig().addAnnotationsToIgnore(LoginMember.class); | ||
} | ||
|
||
@Bean | ||
public OpenAPI openAPI() { | ||
return new OpenAPI().addSecurityItem( | ||
new SecurityRequirement().addList("Bearer Authorization")) | ||
.components(new Components().addSecuritySchemes( | ||
"Bearer Authorization", createBearerTokenScheme() | ||
)); | ||
} | ||
|
||
private SecurityScheme createBearerTokenScheme() { | ||
return new SecurityScheme().type(SecurityScheme.Type.HTTP) | ||
.bearerFormat("JWT") | ||
.scheme("bearer"); | ||
} | ||
} |