Skip to content

Commit

Permalink
Merge pull request #75 from TRIP-Side-Project/dev
Browse files Browse the repository at this point in the history
swagger 전역에 accessToken 헤더 추가
  • Loading branch information
kwondongwook authored Dec 15, 2023
2 parents 36f57ac + 6642b86 commit 3f20407
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/com/api/trip/common/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,28 @@

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.servers.Server;
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 org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Collections;

@Configuration
@OpenAPIDefinition(servers = {@Server(url = "/", description = "Default Server URL")})
public class SwaggerConfig {

@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.components(new Components()
.addSecuritySchemes("accessToken", new SecurityScheme()
.name("accessToken")
.description("accessToken")
.in(SecurityScheme.In.HEADER)
.type(SecurityScheme.Type.APIKEY)))
.security(Collections.singletonList(new SecurityRequirement().addList("accessToken")));
}
}

0 comments on commit 3f20407

Please sign in to comment.