Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am in the process of migrating to spring security plugin from acegi plugin.Currently working on grails environment. I am facing a weird issue as my authentication success event and authentication bad credentials event does not throw at all.I added println statements in the callback in config.groovy and also through listeners.However i can catch events like InteractiveAuthenticationSuccessEvent. Please do reply if you have gone through the same issue

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
238 views
Welcome To Ask or Share your Answers For Others

1 Answer

As mentioned in Chapter 5 of the user guide you need to enable events with "useSecurityEventListener" and configure one or more callback closures, e.g.:

grails.plugins.springsecurity.useSecurityEventListener = true

grails.plugins.springsecurity.onInteractiveAuthenticationSuccessEvent = { e, appCtx ->
   println "onInteractiveAuthenticationSuccessEvent: $e"
}

grails.plugins.springsecurity.onAbstractAuthenticationFailureEvent = { e, appCtx ->
   println "onAbstractAuthenticationFailureEvent: $e"
}

grails.plugins.springsecurity.onAuthenticationSuccessEvent = { e, appCtx ->
   println "onAuthenticationSuccessEvent: $e"
}

grails.plugins.springsecurity.onAuthenticationSwitchUserEvent = { e, appCtx ->
   println "onAuthenticationSwitchUserEvent: $e"
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...