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

Jwt token 의 expire 관리 #37

Open
sanggggg opened this issue Jul 11, 2020 · 0 comments
Open

Jwt token 의 expire 관리 #37

sanggggg opened this issue Jul 11, 2020 · 0 comments
Assignees

Comments

@sanggggg
Copy link
Contributor

현재 server - client 간의 인증 방식으로 jwt token을 이용 중

Jwt token refresh

  • jwt token에 들어가있는 주요 정보로 user identifier 와 expire date 등이 있는데 expire date가 지난 토큰은 만료된 토큰으로 고려, auth를 진행해 주지 않는 방식으로 보안을 유지 중
  • 이때 장기, 주기적 사용자의 경우 jwt token 을 주기적으로 refresh 해 줘야될 필요 있음
  • 따라서 이를 위한 엔드포인트의 추가가 필요할 것 같음

Token refresh 정책

  • 제안 1 : client 는 항상 사용자가 앱을 킬 때 (또는 비슷한 주기로 자주) 토큰을 리프레시 해서 신선한 토큰을 계속 가지고 있는다.
  • 제안 2 : client 는 만료된 token으로 서버에 인증을 요청하면 서버에서 401을 던지고, 이때 클라이언트가 만료된 토큰을 바탕으로 서버에 토큰의 리프레시를 요청한다
    • 단점 : 이러면 딱히 expire date 의 존재 이유가 사라진다. 만료되도 그냥 리프레시 요청만 해서 새로 받으면 되니까?
    • 복잡한? 해결방법 : expire date와 refresh available date 두개의 정보를 토큰에 넣어서 expire 되어도 토큰 리프레시 가능 날짜보다 이전의 토큰의 경우 새로 토큰을 발급해 준다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants