我需要檢查用戶是否已通過生效日期和未過期登錄之前。我應該怎麼做?我有兩個自定義authenticationsuccesshandler
和authenticationfailurehandler
。春季安全檢查生效日期和過期日期登錄之前
<form-login login-page="/login"
authentication-failure-url="/login?error"
authentication-failure-handler-ref="authenticationFailureHandler"
authentication-success-handler-ref="authenticationSuccessHandlerWithoutReferer1"/>
彈簧security.xml文件
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select USER_ID,USER_PWD,USER_STATUS from USER where USER_ID=?"
authorities-by-username-query="select username, authority from authorities where username =? " />
<password-encoder hash="md5"/>
</authentication-provider>
</authentication-manager>
docs告訴你不要在'userDetailsService'中進行認證,雖然看起來更簡單,但正確的方法是使用'customAuthenticationProvider'進行自定義認證處理 – mariubog 2015-01-22 22:26:27
@ user1289300檢查帳戶是否過期未進行認證。定製認證提供者是更多(更難)的工作。 – holmis83 2015-01-22 22:38:43
@ holmis83你是對的。因爲我是春季安保的新手。順便說一下,'AuthenticationFailureHandler'會與'UserDetailsService'一起崩潰嗎? – 2015-01-23 01:06:46