1
這是我春天的security.xml使用彈簧
<http auto-config="true" path-type="ant">
<intercept-url pattern="/myaccount.html*" access="ROLE_CUSTOMER"/>
<intercept-url pattern="/viewpage.html*" access="ROLE_CUSTOMER"/>
<form-login login-page="/login.html"
authentication-success-handler-ref="ssoAuthenticationSuccessHandler"
login-processing-url="/j_security_check" default-target-url="/login.html"
authentication-failure-handler-ref="authenticationFailureHandler"/>
<logout invalidate-session="true" success-handler-ref="ssoLogoutHandler" delete-cookies="JSESSIONID,loggedIn,_bt,slc_f,slc_t,_px_i,attempt_auto_login"/>
<session-management session-fixation-protection="none"/>
</http>
重定向到請求的頁面登錄後,如果用戶訪問某些URL我想攔截他登錄。需要將用戶重定向到原始請求的頁面之後。
上面的xml幫助我攔截用戶訪問viewpage.html但登錄成功後它不會將我帶到viewpage.html。相反,它總是把我帶到myaccount.html。
我認爲這就是我要找的。感謝一噸 – Ijaz
你還可以告訴我什麼時候會調用authentication-success-handler-ref ?.或者我需要手動調用? – Ijaz
實際上,authentication-success-handler-ref會覆蓋默認的AuthenticationSuccessHandler,因此如果您想對身份驗證成功執行一些原始處理,則需要手動執行此操作。 ref ---> http://docs.spring.io/autorepo/docs/spring-security/3.2.9.RELEASE/apidocs/org/springframework/security/web/authentication/SavedRequestAwareAuthenticationSuccessHandler.html – guchuan