-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: booking security 설정 core로 이동 #165
Conversation
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.
확인했습니다! 코멘트 확인 후 머지 부탁드려요 😊
implementation 'io.jsonwebtoken:jjwt-api:0.11.5' | ||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5' | ||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5' | ||
implementation 'io.jsonwebtoken:jjwt-api:0.12.3' |
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.
업데이트 해주셔서 감사합니다 🙇♀️
@Override | ||
public void commence(HttpServletRequest request, HttpServletResponse response, | ||
AuthenticationException authException) throws IOException, ServletException { |
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.
HttpResponseUtil 을 만들어 놓은게 있어서 이걸 적용하면 될 거 같아요~!
@Override | |
public void commence(HttpServletRequest request, HttpServletResponse response, | |
AuthenticationException authException) throws IOException, ServletException { | |
@Slf4j | |
public class BookingAuthEntryPoint implements AuthenticationEntryPoint { | |
@Override | |
public void commence(HttpServletRequest request, HttpServletResponse response, | |
AuthenticationException authException) throws IOException { | |
BaseErrorCode errorCode = BookingErrorCode.BOOKING_TOKEN_NOT_EXIST; | |
ErrorResponse errorResponse = errorCode.getErrorResponse(); | |
HttpResponseUtil.setErrorResponse(response, errorCode.getStatus(), errorResponse); | |
} | |
} | |
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 Keys.hmacShaKeyFor(Decoders.BASE64.decode(secretKey)); | ||
} | ||
|
||
public Authentication getAuthentication(String accessToken) { | ||
Claims claims = Jwts.parserBuilder() | ||
.setSigningKey(key()) | ||
Claims claims = Jwts.parser() |
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.
미뤄두고 있었는데 감사합니다
@@ -40,11 +43,11 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse | |||
} | |||
} | |||
|
|||
private void sendFailResponse(HttpServletResponse response, BookingErrorCode bookingErrorCode) throws IOException { | |||
private void sendFailResponse(HttpServletResponse response, BaseErrorCode bookingErrorCode) throws IOException { |
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.
여기도 HttpResponseUtil 적용할 수 있을 거 같습니다!
private void sendFailResponse(HttpServletResponse response, BaseErrorCode bookingErrorCode) throws IOException { | |
@Component | |
@Slf4j | |
public class BookingExceptionHandlerFilter extends OncePerRequestFilter { | |
@Override | |
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, | |
FilterChain filterChain) throws IOException { | |
try { | |
filterChain.doFilter(request, response); | |
} catch (SecurityCustomException e) { | |
BaseErrorCode bookingErrorCode = e.getErrorCode(); | |
HttpResponseUtil.setErrorResponse(response, bookingErrorCode.getStatus(), bookingErrorCode.getErrorResponse()); | |
} catch (Exception e) { | |
log.error(e.getMessage(), e); | |
BookingErrorCode bookingErrorCode = BookingErrorCode.INTERNAL_SERVER_ERROR; | |
HttpResponseUtil.setErrorResponse(response, bookingErrorCode.getStatus(), bookingErrorCode.getErrorResponse()); | |
} | |
} | |
} | |
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.
수정했습니다!
구현 기능
resolve: #164