Skip to content

Commit

Permalink
Chore: Swagger에 auth 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhacandy authored Sep 20, 2024
2 parents 81d01e5 + 5aba22f commit c77b8f1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/main/java/cotato/growingpain/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package cotato.growingpain.config;

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 io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -11,13 +14,13 @@ public class SwaggerConfig {
public OpenAPI customOpenAPI() {
return new OpenAPI()
.addServersItem(new Server().url("http://43.201.210.211:8080").description("Dev Server"))
.addServersItem(new Server().url("http://localhost:8080").description("Local Server"));
// .addSecurityItem(new SecurityRequirement().addList("bearerAuth"))
// .components(new Components().addSecuritySchemes("bearerAuth",
// new SecurityScheme()
// .type(SecurityScheme.Type.HTTP)
// .scheme("bearer")
// .bearerFormat("JWT"))
// );
.addServersItem(new Server().url("http://localhost:8080").description("Local Server"))
.addSecurityItem(new SecurityRequirement().addList("bearerAuth"))
.components(new Components().addSecuritySchemes("bearerAuth",
new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT"))
);
}
}

0 comments on commit c77b8f1

Please sign in to comment.