From a6a664cb4b97a2d20e85ffb1a6ac0ef9b1d7c27b Mon Sep 17 00:00:00 2001 From: yunhacandy Date: Fri, 20 Sep 2024 20:34:35 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20swagger=EC=97=90=20auth=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../growingpain/config/SwaggerConfig.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/cotato/growingpain/config/SwaggerConfig.java b/src/main/java/cotato/growingpain/config/SwaggerConfig.java index 4e10f6a..6cfbc7d 100644 --- a/src/main/java/cotato/growingpain/config/SwaggerConfig.java +++ b/src/main/java/cotato/growingpain/config/SwaggerConfig.java @@ -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; @@ -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")) + ); } }