From 94d2b68614b30fc8213941af1b7d34674c155058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=99=8D=EC=B0=BD=EA=B8=B0?= Date: Thu, 19 Sep 2024 13:08:30 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20Swagger=EC=97=90=20server=20url=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20-=20S11P21S002-188?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/worlabel/global/config/SwaggerConfig.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/com/worlabel/global/config/SwaggerConfig.java b/backend/src/main/java/com/worlabel/global/config/SwaggerConfig.java index 1f48168..d07779f 100644 --- a/backend/src/main/java/com/worlabel/global/config/SwaggerConfig.java +++ b/backend/src/main/java/com/worlabel/global/config/SwaggerConfig.java @@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn; import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.security.SecurityScheme; +import io.swagger.v3.oas.annotations.servers.Server; import org.springdoc.core.customizers.OperationCustomizer; import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; @@ -16,7 +17,11 @@ import org.springframework.context.annotation.Configuration; title = "auto labeling API", description = "auto labeling API 목록입니다.", version = "v1.0" - ) + ), + servers = { + @Server(url = "https://worlabel.site", description = "Worlabel Server URL"), + @Server(url = "https://j11s002.p.ssafy.io", description = "J11S002 Server URL") + } ) @SecurityScheme( name = "Authorization", From 6ab82fcc3755a7d7198d3be5203039d559ce1fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=99=8D=EC=B0=BD=EA=B8=B0?= Date: Thu, 19 Sep 2024 13:34:53 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20Swagger=EC=97=90=EC=84=9C=20authoriz?= =?UTF-8?q?ation=20header=20=ED=8F=AC=ED=95=A8=ED=95=98=EB=8F=84=EB=A1=9D?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20-=20S11P21S002-188?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/worlabel/global/config/SwaggerConfig.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/worlabel/global/config/SwaggerConfig.java b/backend/src/main/java/com/worlabel/global/config/SwaggerConfig.java index d07779f..f57d0ed 100644 --- a/backend/src/main/java/com/worlabel/global/config/SwaggerConfig.java +++ b/backend/src/main/java/com/worlabel/global/config/SwaggerConfig.java @@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.security.SecurityScheme; import io.swagger.v3.oas.annotations.servers.Server; +import io.swagger.v3.oas.models.security.SecurityRequirement; import org.springdoc.core.customizers.OperationCustomizer; import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; @@ -56,8 +57,9 @@ public class SwaggerConfig { return GroupedOpenApi.builder() .group("token 필요 API") .pathsToExclude(noRequiredTokenApi) - .addOperationCustomizer(operationCustomizer) + .addOperationCustomizer((operation, handlerMethod) -> + operation.addSecurityItem(new SecurityRequirement().addList("Authorization")) + ) .build(); } } -