Skip to content

Commit

Permalink
#46 feat : 스웨거 authorization 활성화
Browse files Browse the repository at this point in the history
  • Loading branch information
Suanna01 committed May 15, 2023
1 parent 9ef2ec5 commit c0bb6b2
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.Arrays;

@Configuration
@EnableSwagger2
public class SwaggerConfig { // Swagger
Expand All @@ -21,6 +24,7 @@ public class SwaggerConfig { // Swagger
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.securitySchemes(Arrays.asList(apiKey())) // swagger에서 jwt 토큰값 넣기위한 설정
.select()
.apis(RequestHandlerSelectors.basePackage("com.zatch.zatchserver")) // Swagger를 적용할 클래스의 package명
.paths(PathSelectors.any()) // 해당 package 하위에 있는 모든 url에 적용
Expand All @@ -35,4 +39,10 @@ public ApiInfo apiInfo() { // API의 이름, 현재 버전, API에 대한 정
.description(API_DESCRIPTION)
.build();
}

// authorization jwt
private ApiKey apiKey() {
return new ApiKey("JWT", "jwt", "header");
}

}

0 comments on commit c0bb6b2

Please sign in to comment.