我正在從acegi插件遷移到spring security插件的過程中。目前正在使用grails環境。我面臨一個奇怪的問題,因爲我的身份驗證成功事件和身份驗證錯誤憑據事件根本不會拋出。我在config.groovy中的回調中還通過偵聽器添加了println語句。但是我可以捕獲InteractiveAuthenticationSuccessEvent等事件。請不要回應,如果你已經通過了同樣的問題Spring安全插件不會拋出事件
0
A
回答
1
瞭如您需要啓用以「useSecurityEventListener」事件,並配置一個或多個回調倒閉,例如user guide的第5章中提到:
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"
}
0
的提供程序管理器默認使用Null事件發佈程序。我們可以在resources.groovy中注入默認的身份驗證事件發佈者。
defaultEventPublisher(DefaultAuthenticationEventPublisher) /** authenticationManager */ authenticationManager(ProviderManager) { authenticationEventPublisher = ref('defaultEventPublisher') providers = listOfProviders }
相關問題
- 1. Grails Spring安全Facebook插件不工作
- 2. 事件不會拋出C++與wxwidgets
- 3. Grails Spring Websocket插件和彈簧安全
- 4. Grails內聯插件和Spring安全
- 5. Grails3的Spring安全休息插件
- 6. grails 2.3.5 + redis-gorm插件+ spring安全核心插件
- 7. 爲什麼textbox.focus會拋出lostFocus事件?
- 8. ADT插件不會安裝
- 9. Grails安全插件
- 10. Grails Spring安全插件和GSP標籤不能正常工作
- 11. 創建組件隨着PERMISSION_SET =不安全拋出一個異常
- 12. 在grails應用程序中安裝spring安全插件
- 13. PHPUnit拋出「Warning:date():這是不安全的...」
- 14. 系統安全拋出:SecurityException
- 15. 安全並拋出異常
- 16. 在Eclipse中安裝STS插件後不會出現Spring項目選擇
- 17. Mailer插件拋出NullPointerException
- 18. Wordpress插件template_redirect拋出404
- 19. Jenkins TFS插件拋出NumberFormatException
- 20. WordPress的插件拋出404
- 21. Clojail不會在Clojure中拋出安全異常
- 22. 使用Eclipse開普安裝Spring IDE 3.4.0插件時出錯開普勒:不會安裝(Spring IDE Roo支持)
- 23. dojo小部件不會發出事件
- 24. 安全事件分類
- 25. C#:線程安全事件
- 26. 爲什麼事務不會拋出TimeoutException?
- 27. 插件的安全限制?
- 28. javascript故障安全插件
- 29. 安全和MAF插件
- 30. Qt插件&&線程安全
嘿,我試圖做所有這些,但問題是這些事件從未被調用的。我只能接收onInteractiveAuthenticationSuccessEvent。我瀏覽了Spring源代碼,並在AbstractAuthenticationProcessingFilter類中進行了驗證,他們僅在成功驗證時拋出onInteractiveAuthenticationSuccessEvent,在驗證失敗時他們只是調用失敗處理程序。是否需要添加處理程序而不是偵聽事件?還是我需要注入供應商經理?我沒有添加任何供應商經理,認爲grails的插件會爲我做:( – prabha 2010-06-29 05:19:24
嗯,看起來像Spring Security 2和3之間的事情發生了變化。請在http://jira.codehaus.org/上創建一個問題。瀏覽/ Grails-Spring-Security-Core組件下的GRAILSPLUGINS,我將看到我可以爲下一個版本做些什麼 – 2010-06-29 05:46:09
嘿,感謝您的關注。我們記錄了一個bug,就像你說的http://jira.codehaus .org/browse/GRAILSPLUGINS-2248 – prabha 2010-06-29 09:05:06