Skip to content

Commit

Permalink
MATE-98 : [FIX] SwaggerConfig 클래스 포트번호 변경 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongjeZZ authored Dec 5, 2024
1 parent fc4604e commit 55819e0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/com/example/mate/common/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.example.mate.common.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -19,6 +22,15 @@ public OpenAPI openAPI() {

return new OpenAPI()
.info(info)
.servers(List.of(new Server().url("http://localhost:8000")));
.servers(List.of(new Server().url("http://localhost:8080")))
.addSecurityItem(new SecurityRequirement().addList("Bearer Authentication"))
.components(new Components().addSecuritySchemes("Bearer Authentication", createAPIKeyScheme()));
}

private SecurityScheme createAPIKeyScheme() {
return new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.bearerFormat("JWT")
.scheme("bearer");
}
}

0 comments on commit 55819e0

Please sign in to comment.