I'm using spring-security-core plugin to handle authentication and security.
I have done this in the past so I thought I better document this in a way that I don't have to dig up my old code from the annals of... well
Taking advantage of Listener s
I don't want this cluttering my application logic and since Grails is a spring application, I turned my attention to So, lets start our (short) implementation of this. First you will have to tell spring-security to publish http session events so that you can catch them later. In order to do so, add the following line to your
grails.plugin.springsecurity.useHttpSessionEventPublisher = true
Now you have to implement your listener:
import org.springframework.context.ApplicationListener
import org.springframework.security.core.session.SessionDestroyedEvent
public class MyLogoutEventListener implements ApplicationListener<SessionDestroyedEvent> {
@Override
public void onApplicationEvent(SessionDestroyedEvent event){
/*Your code here*/
}
}
(If you're not sure where to put it, place it in your And then you need to register this bean in
beans = {
myLogoutEventListener(MyLogoutEventListener)
}
Note: Your
No comments:
Post a Comment