Skip to content

Commit

Permalink
[BE] fix(SwaggerConfig): ForwardedHeaderFilter 추가 (#111)
Browse files Browse the repository at this point in the history
* fix(SwaggerConfig): ForwardedHeaderFilter 추가

- 리버스 프록시 뒤에서 동작하는 swagger에서 https 스키마를 자동 인식하지 못하는 문제 수정

* refactor(SwaggerConfig): API 버전 정보를 필드가 아닌 생성자에서 주입받도록 변경

* refactor(SwaggerConfig): `@Bean` 메서드들의 접근제어자를 `protected`로 변경

* chore: 서브모듈 업데이트 반영

* refactor(SwaggerConfig): 현재 불필요한 API 버전 필드 제거
  • Loading branch information
hw0603 authored Jul 30, 2024
1 parent 8a3ead2 commit 49610ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.security.SecurityScheme.Type;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.ForwardedHeaderFilter;

@Configuration
public class SwaggerConfig {

@Value("${apiVersion}")
private static String apiVersion;
@Bean
protected ForwardedHeaderFilter forwardedHeaderFilter() {
return new ForwardedHeaderFilter();
}

@Bean
public OpenAPI openAPI() {
protected OpenAPI openAPI() {
Components authComponent = new Components().addSecuritySchemes("Bearer Token", apiAuth());
SecurityRequirement securityRequirement = new SecurityRequirement().addList("Bearer Token");

Expand All @@ -36,7 +38,6 @@ private SecurityScheme apiAuth() {
private Info apiInfo() {
return new Info()
.title("momo API")
.description("momo API 입니다.")
.version(apiVersion);
.description("momo API 입니다.");
}
}
2 changes: 1 addition & 1 deletion backend/src/main/resources/security

0 comments on commit 49610ec

Please sign in to comment.