-
Notifications
You must be signed in to change notification settings - Fork 0
feat: api-gateway 구현 #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- TokenValidator를 제거하고 TokenProvider 중심의 인증 구조로 통일 - isValidToken 메서드를 extractClaims로 대체하여 Claims 반환 기반 검증 방식으로 변경 - 블랙리스트 체크 및 토큰 파싱 로직을 하나의 흐름으로 통합
- Claims 기반으로 사용자 이메일, 타입, 상태 정보를 헤더에 추가 - 필터에서 인증 후 사용자 정보 전달을 위한 ServerWebExchange 변형 지원
| validateStoredRefreshToken(email, refreshToken); | ||
| Token newToken = generateAndStoreToken(email, userPrincipal.getUserType(), userPrincipal.getUserStatus()); | ||
| Token newToken = generateAndStoreToken(email, UserType.valueOf(userType), UserStatus.valueOf(userStatus)); | ||
| return new TokenResponseDto(newToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return new TokenResponseDto(this.generateAndStoreToken(email, UserType.valueOf(userType), UserStatus.valueOf(userStatus)));
| public Mono<Void> filter(final ServerWebExchange exchange, final GatewayFilterChain chain) { | ||
| final ServerHttpRequest request = exchange.getRequest(); | ||
|
|
||
| if (isWhitelisted(request)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WhitelistMatcher.isWhitelisted;
| public String resolveToken(final ServerHttpRequest request) { | ||
| final String authHeader = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION); | ||
| if (authHeader == null || !authHeader.startsWith(BEARER_PREFIX)) { | ||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "";
|
|
||
| public class HttpResponseUtils { | ||
|
|
||
| private static final String JSON_CONTENT_TYPE = "application/json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private final String JSON_CONTENT_TYPE = "application/json";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private String JSON_CONTENT_TYPE = "application/json";
| @RequiredArgsConstructor | ||
| public class RedisTokenRepository { | ||
|
|
||
| private static final String BLACKLIST_KEY = "black_list:"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final String BLACKLIST_KEY = "black_list:";
private final String BLACKLIST_KEY = "black_list:";
No description provided.