首页 文章

在grails中记录失败的登录尝试

提问于
浏览
0

我在Grails中使用acegi安全性 . 有没有办法将失败的登录尝试记录为信息或警告,所以:

错误springsecurity.GrailsDaoImpl - 找不到用户:XXXXXX

是否按需记录?

谢谢

1 回答

  • 2

    您可以注册安全事件的侦听器,检查失败的登录事件

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

    或者,您可以注册在触发事件时调用的回调闭包

    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
    }
    

相关问题