Skip to content

Commit

Permalink
chore: 주석 설명 추가 - PR 리뷰 반영 (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
parkje0927 committed Jul 13, 2023
1 parent 6be92cf commit d0ffc99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Swagger Security 적용에서 제외시키는 어노테이션
* - 토큰 검증이 불필요한 엔드포인트에 @SecurityExclusion 적용하여 사용 가능
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface SecurityExclusion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public OpenAPI springOpenAPI() {
.info(info);
}

/**
* Swagger Security 적용
* - Bearer Authentication 설정
* - 토큰 검증이 필요한 엔드포인트에 @SecurityRequirement(name = "accessToken") 적용하여 사용 가능
* - key 값인 accessToken 은 자유롭게 설정 가능
*/
private Components securitySetting() {
return new Components()
.addSecuritySchemes("accessToken",
Expand All @@ -51,6 +57,10 @@ private Components securitySetting() {
.name("Authorization"));
}

/**
* Swagger Operation 커스텀
* - @SecurityExclusion 이 붙은 곳은 security 적용 제외
*/
@Bean
public OperationCustomizer operationCustomizer() {
return (Operation operation, HandlerMethod handlerMethod) -> {
Expand Down

0 comments on commit d0ffc99

Please sign in to comment.