Skip to content

Commit

Permalink
Merge pull request #153
Browse files Browse the repository at this point in the history
Fix: 토큰 오류메세지 수정, 액세스토큰오류 디스코드 전송X
  • Loading branch information
BYEONGRYEOL committed Sep 3, 2024
2 parents c16cd6b + 161dd09 commit a38cb0f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void validateToken(String token) {
} catch (MalformedJwtException | IllegalArgumentException | UnsupportedJwtException | SignatureException e) {
throw ExpectedException.withLogging(ResponseCode.INVALID_TOKEN);
} catch (ExpiredJwtException e) {
throw ExpectedException.withLogging(TOKEN_EXPIRED);
throw ExpectedException.withoutLogging(TOKEN_EXPIRED);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public enum ResponseCode {
* 인증/인가
*/
TOKEN_NOT_PROVIDED(ErrorConstants.TOKEN_NOT_PROVIDED, HttpStatus.UNAUTHORIZED, false, "토큰이 전달되지 않았습니다."),
TOKEN_EXPIRED(ErrorConstants.TOKEN_EXPIRED, HttpStatus.UNAUTHORIZED, false, "토큰이 만료되었습니다."),
TOKEN_EXPIRED(ErrorConstants.TOKEN_EXPIRED, HttpStatus.UNAUTHORIZED, false, "액세스 토큰이 만료되었습니다."),
INVALID_TOKEN(ErrorConstants.INVALID_TOKEN, HttpStatus.UNAUTHORIZED, false, "유효하지 않은 토큰입니다."),
INSUFFICIENT_PERMISSIONS(ErrorConstants.INSUFFICIENT_PERMISSIONS, HttpStatus.FORBIDDEN, false, "접근 권한이 부족합니다."),
REFRESH_TOKEN_EXPIRED(ErrorConstants.REFRESH_TOKEN_EXPIRED, HttpStatus.UNAUTHORIZED, false, "리프레시 토큰이 만료되었습니다."),
Expand Down Expand Up @@ -116,9 +116,9 @@ public enum ResponseCode {
false,
"사진생성요청을 요청한 유저만 볼 수 있습니다."),
PictureGenerateRequestAlreadyProcessed(ErrorConstants.PictureGenerateRequestAlreadyProcessed,
BAD_REQUEST,
false,
"사진생성요청이 이미 처리중입니다."),
BAD_REQUEST,
false,
"사진생성요청이 이미 처리중입니다."),
/**
* User
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.apache.commons.text.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -43,11 +44,13 @@ public class DiscordAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {
private String username = "Error log";
private String adminAvatarUrl = "https://img.icons8.com/ios-filled/50/FA5252/business.png";
private String errorAvatarUrl = "https://img.icons8.com/ios-filled/50/22C3E6/error--v1.png";
private String devErrorAvatarUrl = "https://img.icons8.com/ios-filled/50/FFFFFF/error--v1.png";
private String eventAvatarUrl = "https://img.icons8.com/ios-filled/50/40C057/confetti.png";

@Override
protected void append(ILoggingEvent eventObject) {
DiscordWebHook discordWebhook = new DiscordWebHook(username, errorAvatarUrl, false);
String avatarUrl = Objects.equals(profile, "staging") ? devErrorAvatarUrl : errorAvatarUrl;
DiscordWebHook discordWebhook = new DiscordWebHook(username, avatarUrl, false);
Map<String, String> mdcPropertyMap = eventObject.getMDCPropertyMap();
Color messageColor = getLevelColor(eventObject);

Expand Down

0 comments on commit a38cb0f

Please sign in to comment.