Skip to content

Commit

Permalink
fix(Session): Remove Session ID from Redis after logout (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima authored Aug 2, 2022
1 parent 8dfb332 commit 51bd8e6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,23 @@
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.session.SessionDestroyedEvent;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.logout.LogoutHandler;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.session.Session;
import org.wise.portal.service.session.SessionService;

public class WISELogoutHandler<S extends Session> implements LogoutHandler,
public class WISELogoutHandler<S extends Session> extends SecurityContextLogoutHandler implements
ApplicationListener<SessionDestroyedEvent> {

@Autowired
protected SessionService sessionService;

@Override
public void logout(HttpServletRequest request, HttpServletResponse response,
public void logout(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) {
if (authentication != null) {
sessionService.removeUser((UserDetails) authentication.getPrincipal());
}
super.logout(request, response, authentication);
}

@Override
Expand Down

0 comments on commit 51bd8e6

Please sign in to comment.