tags:

views:

24

answers:

1

I'm using acegi security in Grails. Is there a way to log a failed login attempt as info or warning so:

ERROR springsecurity.GrailsDaoImpl - User not found: XXXXXX

is logged as required ?

Thanks

+2  A: 

You can register listeners for security events, check for the failed login event

http://grails.org/AcegiSecurity+Plugin+-+Acegi+Events

Or you can register call back closures that are called when the events are triggered

useSecurityEventListener = true

onInteractiveAuthenticationSuccessEvent = {e, appCtx ->
    // handle InteractiveAuthenticationSuccessEvent
}

onAbstractAuthenticationFailureEvent = {e, appCtx ->
    // handle AbstractAuthenticationFailureEvent
}

onAuthenticationSuccessEvent = {event, appCtx ->
    // handle AuthenticationSuccessEvent
}
onAuthenticationSwitchUserEvent = {e, appCtx ->
    // handle AuthenticationSwitchUserEvent
}
onAuthorizationEvent = {e, appCtx ->
    // handle AuthorizationEvent
}
Aaron Saunders
He's using the Acegi plugin, so it's very similar but the docs are at http://grails.org/AcegiSecurity+Plugin+-+Acegi+Events
Burt Beckwith