Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#46 feat : 스웨거 authorization 활성화 #51

Merged
merged 1 commit into from
May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}

}