Skip to Content
Suffering builds character

6.로그아웃

1. 로그아웃 처리

스프링 시큐리티는 기본적으로 /logout 경로를 통해 기본적인 로그아웃 기능을 제공함

1-2. 로그아웃 처리의 동작 과정

GET: /logout 경로로 요청 시 로그아웃 진행 여부에 대한 페이지를 응답,

POST: /logout 요청 시 LogoutHandler에 의해 아래와 같은 처리가 수행됨

  1. Invalidate the HTTP session (SecurityContextLogoutHandler)
    → 세션 초기화

  2. Clear the SecurityContextHolderStrategy (SecurityContextLogoutHandler)

  3. Clear the SecurityContextRepository (SecurityContextLogoutHandler)
    SecurityContextHolder 관련 객체 초기화

  4. Clean up any RememberMe authentication (TokenRememberMeServices / PersistentTokenRememberMeServices)
    RememberMe 인증 초기화

  5. Clear out any saved CSRF token (CsrfLogoutHandler)
    CSRF 토큰 초기화

  6. Fire a LogoutSuccessEvent (LogoutSuccessEventPublishingLogoutHandler)
    LogoutSuccessEvent 호출

Last updated on