Hi.
I have a problem with users logged in. When I hit back on the browser or simply will go to login page id doesn't redirect me to home page. I don't really know if this should be default behavior of spring security so maybe anyone can give me some advice??
My codes:
security-context.xml
on successful login:Code:<http auto-config="true"> <intercept-url pattern="/css/**" filters="none"/> <intercept-url pattern="/images/**" filters="none"/> <intercept-url pattern="/reports/*" access="ROLE_ADMIN"/> <intercept-url pattern="/temp/*" access="ROLE_ADMIN"/> <intercept-url pattern="/login.zul*" access="IS_AUTHENTICATED_ANONYMOUSLY"/> <intercept-url pattern="/zul/**" access="ROLE_USER,ROLE_ADMIN"/> <intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/> <form-login login-page="/login.zul" default-target-url="/zul/test.zul" always-use-default-target="true" authentication-success-handler-ref="authenticationHandler" authentication-failure-url="/login.zul?login_error=1"/> </http> <beans:bean id="authenticationHandler" class="CustomAuthenticationHandler"> <beans:property name="defaultTargetUrl" value="/zul/test.zul"/> <beans:property name="alwaysUseDefaultTargetUrl" value="true"/> </beans:bean> <beans:bean id="CustomProvider" class="CustomLoginProvider"/> <authentication-manager> <authentication-provider ref="CustomProvider"/> </authentication-manager>
Code:public class CustomAuthenticationHandler extends SavedRequestAwareAuthenticationSuccessHandler { @Override public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { ....///some logic here super.onAuthenticationSuccess(httpServletRequest, httpServletResponse, authentication); }


Reply With Quote