代码之家  ›  专栏  ›  技术社区  ›  xain

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

  •  0
  • xain  · 技术社区  · 15 年前

    我在Grails中使用Acegi Security。是否可以将失败的登录尝试记录为信息或警告,以便:

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

    是否按要求记录?

    谢谢

    1 回复  |  直到 15 年前
        1
  •  2
  •   Aaron Saunders    15 年前

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

    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
    }
    
    推荐文章