Skip to content

Commit

Permalink
Merge pull request #34 from Tico-Corp/fix-be/TICO-215-resolve-swagger…
Browse files Browse the repository at this point in the history
…-ui-error

[FIX] X-Forwarded 헤더 처리 개선 (TICO-215)
  • Loading branch information
bu119 authored Jul 12, 2024
2 parents 061c6fc + b6a4227 commit bb69c83
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SecurityConfig {
};

private static final String[] swaggerURL = {
"/api/**", "/graphiql", "/graphql",
"/graphiql", "/graphql",
"/swagger-ui/**", "/swagger-ui.html",
"/v3/api-docs/**", "/api-docs/**",
"/swagger-ui/index.html/**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
import org.springframework.context.annotation.Configuration;

@OpenAPIDefinition(
info = @Info(title = "Pomoro-Do API 명세서",
description = "Pomoro-Do 서비스의 API 명세서입니다.",
version = "v1"))
info = @Info(
title = "Pomoro-Do API 명세서", // 서비스 이름
description = "Pomoro-Do 서비스의 API 명세서입니다.", // 서비스 설명
version = "v1" // 서비스 버전
)
)
//@SecurityScheme(
// name = "bearerAuth",
// type = SecuritySchemeType.HTTP,
Expand All @@ -32,18 +35,22 @@ public class SwaggerConfig {
@Bean
public OpenAPI openAPI() {

// 인증 요청 방식에 HEADER 추가
SecurityScheme securityScheme = new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")
.in(SecurityScheme.In.HEADER)
.name("Authorization");

// bearerAuth 이름으로 보안 요구사항 정의
SecurityRequirement securityRequirement = new SecurityRequirement()
.addList("bearerAuth");

return new OpenAPI()
// SecurityRequirement에 정의한 bearerAuth, 위에서 정의한 securityScheme 추가
.components(new Components().addSecuritySchemes("bearerAuth", securityScheme))
// 보안 규칙 추가
.addSecurityItem(securityRequirement);
}

Expand Down
1 change: 1 addition & 0 deletions backend/pomoro-do/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
server:
port: 8080 #애플리케이션 서버 포트번호 설정 (8080 포트에서 수신 대기하도록 설정)
forward-headers-strategy: FRAMEWORK # Spring-boot 서버에서 이용할 Forward-proxy와 관련된 설정

spring:
application:
Expand Down

0 comments on commit bb69c83

Please sign in to comment.