Skip to content

Commit

Permalink
fix: swagger 서버 주소 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
This2sho committed Mar 18, 2024
1 parent 83d42ee commit cbbe6c1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/com/example/parking/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.security.SecurityScheme.In;
import io.swagger.v3.oas.models.security.SecurityScheme.Type;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -16,13 +17,15 @@
@Configuration
public class SwaggerConfig {

private static final String JSESSIONID = "JSESSIONID";

@Bean
public OpenAPI openAPI() {
SecurityScheme auth = new SecurityScheme()
.type(Type.APIKEY).in(In.COOKIE).name("JSESSIONID");
SecurityRequirement securityRequirement = new SecurityRequirement().addList("JSESSIONID");
.type(Type.APIKEY).in(In.COOKIE).name(JSESSIONID);
SecurityRequirement securityRequirement = new SecurityRequirement().addList(JSESSIONID);

return new OpenAPI()
return new OpenAPI().addServersItem(new Server().url("/"))
.components(new Components().addSecuritySchemes("JSESSIONID", auth))
.addSecurityItem(securityRequirement);
}
Expand Down

0 comments on commit cbbe6c1

Please sign in to comment.