[keycloak-user] Session destruction listener

Jason Rodis jasrodis at gmail.com
Mon Oct 13 07:44:48 EDT 2014


Good morning,

I am trying to set up an application that uses:

1. Spring 3.2.x

I used to have spring security for the authentication of the users, and I could have a logout listener, triggering the SessionDestroyedEvent like this (whenever a session was destroyed) :

@Service
public class LogoutListener implements ApplicationListener<SessionDestroyedEvent> {

    @Autowired
    private SessionRegistryImpl sessionRegistry;

    @Override
    public void onApplicationEvent(SessionDestroyedEvent event) {
        List<SecurityContext> lstSecurityContext = event.getSecurityContexts();
        AuthenticateUser authenticateUser;
        for (SecurityContext securityContext : lstSecurityContext) {
            authenticateUser = (AuthenticateUser) securityContext.getAuthentication().getPrincipal();
            logger.trace("Current session destroyed from user [{}]", authenticateUser.getEmail());


            //Handle the session destruction event..


        }
    }
}


Is there any way I could have that functionality with Keycloak?

Thanks in advance,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20141013/6ea9a463/attachment.html 


More information about the keycloak-user mailing list