Skip to content

Conversation

@gnsdp99
Copy link
Collaborator

@gnsdp99 gnsdp99 commented Aug 29, 2025

Resolved Issue

PR Description

액세스 토큰 전달 방식 변경

  • 기존 쿠키로 전달하던 것을 Authorization 헤더로 전달하도록 변경했습니다.
  • 쿠키로 전달 시 만료되면 자동으로 삭제되어 재발급하기 어려웠던 문제를 해결했습니다.
  • 토큰 검증 시에는 표준화된 방식인 Bearer 인증 방식을 사용했습니다.

CookieUtil 클래스 메서드명 및 예외 메시지 변경

  • getTokenFromCookie 메서드가 토큰 뿐만 아니라 쿠키의 값을 꺼낸다는 더 넓은 범위의 메서드로 사용되도록 변경했습니다.
  • 예외 메시지 또한 클라이언트에서 쿠키가 문제라는 명확한 메시지를 받을 수 있도록 수정했습니다.
// before
public static String getTokenFromCookie(final Cookie[] cookies, final String name) {
    if (cookies == null) {
        throw new JobNoteException(INVALID_TOKEN);
    }

    return Arrays.stream(cookies)
            .filter(cookie -> name.equals(cookie.getName()))
            .findFirst()
            .orElseThrow(() -> new JobNoteException(INVALID_TOKEN))
            .getValue();
}

// after
public static String getValueFromCookie(final Cookie[] cookies, final String name) {
    if (cookies == null) {
        throw new JobNoteException(INVALID_COOKIE);
    }

    return Arrays.stream(cookies)
            .filter(cookie -> name.equals(cookie.getName()))
            .findFirst()
            .orElseThrow(() -> new JobNoteException(INVALID_COOKIE))
            .getValue();
}

Others

Copy link
Collaborator

@hyotatoFrappuccino hyotatoFrappuccino left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

@gnsdp99 gnsdp99 merged commit 050d686 into dev Aug 30, 2025
3 checks passed
@gnsdp99 gnsdp99 deleted the feat/#75 branch August 30, 2025 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: JWT 토큰 전달 방식 변경

3 participants