private void generateAuthenticationEvent ( HttpServletRequest request , HttpServletResponse response ) { try { Optional < JwtHttpHandler . Token > token = jwtHttpHandler . getToken ( request , response ) ; String userLogin = token . isPresent ( ) ? token . get ( ) . getUserDto ( ) . getLogin ( ) : null ; authenticationEvent . logoutSuccess ( request , userLogin ) ; } catch ( AuthenticationException e ) { authenticationEvent . logoutFailure ( request , e . getMessage ( ) ) ; } }
The generation of the authentication event should not prevent the removal of JWT cookie that s why it s done in a separate method