Skip to content

Commit

Permalink
Merge pull request #458 from jminkkk/refactor/remove_authorization_in…
Browse files Browse the repository at this point in the history
…terceptor

회원만 접근할 수 있는 엔드포인트 검증용 interceptor 제거
  • Loading branch information
Jaymyong66 authored Aug 16, 2024
2 parents 6a72dda + 72ff03e commit cfc9be4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import codezap.auth.manager.CredentialManager;
Expand All @@ -22,12 +21,4 @@ public class AuthWebConfiguration implements WebMvcConfigurer {
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
resolvers.add(new AuthArgumentResolver(credentialManager, credentialProvider));
}

@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new AuthorizationInterceptor(credentialManager, credentialProvider))
.addPathPatterns("/members/**")
.addPathPatterns("/templates/**")
.addPathPatterns("/categories/**");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

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.security.SecurityScheme.In;
import io.swagger.v3.oas.models.security.SecurityScheme.Type;
import io.swagger.v3.oas.models.servers.Server;

@Configuration
Expand All @@ -23,7 +28,15 @@ public OpenAPI openAPI() {
모든 예외 응답의 메시지는 "detail" : "내부 서버 오류입니다." 와 같은 형태로 응답합니다. \n
""");

Components cookieComponent = new Components()
.addSecuritySchemes("쿠키 인증 토큰", new SecurityScheme()
.type(Type.APIKEY)
.in(In.COOKIE)
.name("credential"));

return new OpenAPI()
.info(info)
.components(cookieComponent)
.servers(
List.of(
new Server()
Expand All @@ -34,7 +47,7 @@ public OpenAPI openAPI() {
.description("BE 팀에서 사용할 로컬 환경 테스트를 위한 서버입니다.")
)
)
.info(info);
.addSecurityItem(new SecurityRequirement().addList("쿠키 인증 토큰"));
}

@Bean
Expand Down

0 comments on commit cfc9be4

Please sign in to comment.