Skip to content

Commit

Permalink
#31 fix: AuthPrincipalArgumentResolver 설정 추가
Browse files Browse the repository at this point in the history
- 로그인한 사용자의 정보가 담긴 AuthMember 매개변수에 정보를 넣어주기 위해서 리졸버를 추가하였습니다.
  • Loading branch information
yonghwankim-dev committed Nov 24, 2023
1 parent f44d012 commit 43a863f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/codesquad/fineants/spring/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
package codesquad.fineants.spring.config;

import java.util.List;

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 codesquad.fineants.domain.oauth.support.AuthPrincipalArgumentResolver;
import codesquad.fineants.spring.intercetpor.LogoutInterceptor;
import lombok.RequiredArgsConstructor;

@Configuration
@RequiredArgsConstructor
public class WebConfig implements WebMvcConfigurer {

private final AuthPrincipalArgumentResolver authPrincipalArgumentResolver;

@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LogoutInterceptor())
.addPathPatterns("/api/auth/logout");
}

@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
resolvers.add(authPrincipalArgumentResolver);
}
}

0 comments on commit 43a863f

Please sign in to comment.