diff --git a/src/main/java/com/example/mate/common/config/SwaggerConfig.java b/src/main/java/com/example/mate/common/config/SwaggerConfig.java index 66086c60..862b8e76 100644 --- a/src/main/java/com/example/mate/common/config/SwaggerConfig.java +++ b/src/main/java/com/example/mate/common/config/SwaggerConfig.java @@ -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; @@ -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"); } } \ No newline at end of file diff --git a/src/main/java/com/example/mate/common/security/filter/JwtCheckFilter.java b/src/main/java/com/example/mate/common/security/filter/JwtCheckFilter.java index eb982113..e1b668d5 100644 --- a/src/main/java/com/example/mate/common/security/filter/JwtCheckFilter.java +++ b/src/main/java/com/example/mate/common/security/filter/JwtCheckFilter.java @@ -73,8 +73,6 @@ private boolean isAuthExcludedPath(HttpServletRequest request) { // 소셜 로그인/회원 가입 경로, mate 서비스 로그인/회원 가입 경로 인증 제외 return requestURI.startsWith("/api/auth") || - // 프론트엔드 테스트를 위해 모든 요청 허용 - requestURI.startsWith("/") || requestURI.startsWith("/api/members/join") || requestURI.startsWith("/swagger-ui") || requestURI.startsWith("/api/members/login");