access_token은 js local variable로 관리, refresh_token은 httpOnly, secure cookie에 저장해서 사용
silent refresh 조건
js local variable 없는 경우
(axios Authorization header로 등록된 것이 없으면 refresh 통해 access_token 받아와 새로 설정)
access_token 만료된 경우
(local variable로 지정한 access_token에 setTimeout 같은 걸로 설정해서 시간이 지나면 알아서 refresh 되도록 하는 것과 api 요청시 AUTH_TOKEN_EXPIRED errorCode로 응답이 오면 refresh 하는 방식을 이중으로 적용해볼 수도 있을 듯 하다.)
무엇보다 인증서버에 대해서 적절한 방화벽 혹은 ACL 설정을 하는 것이 좋아보임
front application이 돌아갈 서버 -> 인증서버 이렇게 ACL이나 방화벽으로 설정하는 것이 좋아보임(CSRF 공격으로부터 어느정도 방어를 기대해 볼 수 있음)
대책은?
refresh_token >> httpOnly, secure, domain 적용된 cookie에 담아서 처리
access_token은 private variable로 담아서 사용
silent refresh 케이스
cookie에 있는 refreshToken만을 가지고 갱신(access, refresh 둘 다)
api 호출했을 때 access_token 만료시 TOKEN_EXPIRED 반환 > 다시 silent refresh api 호출
브라우저 새로고침하거나 처음 진입시 쿠키에 refresh_token 있는 경우
로그인 인증해야하는 케이스
silent refresh 했는데 refresh_token이 없는 경우 > unauthorized 상태로 간주
Overview
변경내용
@RedisHash
로 수정해서 작업@Indexed
는 사용하지 않는 것으로@TimeToLive
)기록
Redis 관련
보안 관련
(axios Authorization header로 등록된 것이 없으면 refresh 통해 access_token 받아와 새로 설정)
(local variable로 지정한 access_token에 setTimeout 같은 걸로 설정해서 시간이 지나면 알아서 refresh 되도록 하는 것과 api 요청시 AUTH_TOKEN_EXPIRED errorCode로 응답이 오면 refresh 하는 방식을 이중으로 적용해볼 수도 있을 듯 하다.)
front application이 돌아갈 서버 -> 인증서버
이렇게 ACL이나 방화벽으로 설정하는 것이 좋아보임(CSRF 공격으로부터 어느정도 방어를 기대해 볼 수 있음)대책은?