Skip to content
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

Merged
merged 5 commits into from
Jan 9, 2024
Merged

fix: booking security 설정 core로 이동 #165

merged 5 commits into from
Jan 9, 2024

Conversation

annahxxl
Copy link
Collaborator

@annahxxl annahxxl commented Jan 9, 2024

구현 기능

  • booking jwt 관련 파일 core-security로 이동
  • jjwt 버전 업데이트 및 메서드 sync

resolve: #164

Copy link
Collaborator

@eunbc eunbc left a 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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

업데이트 해주셔서 감사합니다 🙇‍♀️

Comment on lines 30 to 32
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpResponseUtil 을 만들어 놓은게 있어서 이걸 적용하면 될 거 같아요~!

Suggested change
@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);
}
}

Copy link
Collaborator Author

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()
Copy link
Collaborator

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 {
Copy link
Collaborator

@eunbc eunbc Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 HttpResponseUtil 적용할 수 있을 거 같습니다!

Suggested change
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());
}
}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했습니다!

@annahxxl annahxxl merged commit 5cbc5b9 into main Jan 9, 2024
1 check passed
@annahxxl annahxxl deleted the booking/164 branch January 9, 2024 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
booking 예매 fix 수정
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

fix: booking security 설정 core로 이동
3 participants