There are many times when we would like to do something when a user has successfully logged in, like putting a log entry, resetting failed counters etc. Below is a snippet of code which does something similar. Place this piece of code in your grails Config.groovy file.
grails.plugins.springsecurity.useSecurityEventListener = true
grails.plugins.springsecurity.onInteractiveAuthenticationSuccessEvent = { e, appCtx ->
println "User " + appCtx.springSecurityService.principal.id + " has successfully logged in"
...
...
}
No comments:
Post a Comment