Skip to content

Commit

Permalink
Merge pull request #97 from mju-likelion/feature/refactor-interceptor…
Browse files Browse the repository at this point in the history
…-logic-#96

Feature#96 인터셉터 �URI 설정 로직 리팩토링
  • Loading branch information
aaahyunseo authored Sep 10, 2024
2 parents c45947e + e07362e commit 04596b2
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,27 @@
@Configuration
@RequiredArgsConstructor
public class AuthenticationConfig implements WebMvcConfigurer {

private final AuthenticationInterceptor authenticationInterceptor;
private final AuthenticatedUserArgumentResolver authenticatedUserArgumentResolver;
private static final String[] ADD_PLANNER_API_PATH = {"/planners", "planners/{plannerId}", "/planners/{plannerId}/complete", "planners/calendars"};
private static final String[] ADD_DIARY_API_PATH = {"/diaries", "diaries/{diaryId}"};
private static final String[] ADD_ROOM_API_PATH = {"/rooms", "rooms/{roomId}"};
private static final String[] ADD_USER_API_PATH = {"/users", "users/grade", "users/mypage"};
private static final String ADD_SURVEY_API_PATH = "/surveys";
private static final String ADD_AUTH_API_PATH = "/auth/logout";
private static final String[] EXCLUDE_AUTH_API_PATH = {"/auth/login", "/auth/signup", "/auth/refresh"};

@Override
public void addInterceptors(final InterceptorRegistry registry) {
registry.addInterceptor(authenticationInterceptor)
.addPathPatterns("/planners/**", "/diaries/**", "/rooms/**", "/users/**", "/surveys", "/auth/logout")
.excludePathPatterns("/auth/signup", "/auth/login", "/auth/refresh");
.addPathPatterns(ADD_PLANNER_API_PATH)
.addPathPatterns(ADD_DIARY_API_PATH)
.addPathPatterns(ADD_ROOM_API_PATH)
.addPathPatterns(ADD_USER_API_PATH)
.addPathPatterns(ADD_SURVEY_API_PATH)
.addPathPatterns(ADD_AUTH_API_PATH)
.excludePathPatterns(EXCLUDE_AUTH_API_PATH);
}

@Override
Expand Down

0 comments on commit 04596b2

Please sign in to comment.