Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用spring登录后重定向到请求的页面_Spring_Security_Redirect_Login - Fatal编程技术网

使用spring登录后重定向到请求的页面

使用spring登录后重定向到请求的页面,spring,security,redirect,login,Spring,Security,Redirect,Login,这是我的spring-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-l

这是我的spring-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,我想拦截他登录。之后,它需要被用户重定向到原始请求页面


当用户访问viewpage.html时,上面的xml帮助我拦截,但在登录成功后,它不会将我带到viewpage.html。相反,它总是将我带到myaccount.html。

SavedRequestAwareAuthenticationSuccessHandler用作AuthenticationSuccessHandler的默认实现类

这应该像你期望的那样工作


我不确定身份验证成功处理程序ref=“SSAuthenticationSuccessHandler”应该做什么,但是,请尝试查看SavedRequestAwareAuthenticationSuccessHandler,看看是否有任何线索。

SavedRequestAwareAuthenticationSuccessHandler用作AuthenticationSuccessHandler的默认实现类

这应该像你期望的那样工作


我不确定认证成功处理程序ref=“ssoAuthenticationSuccessHandler”应该做什么,但请尝试查看SavedRequestAwareAuthenticationSuccessHandler,看看是否可以得到任何线索。

您是否可以告诉我何时调用认证成功处理程序ref?。或者我需要手动调用吗?实际上,authentication success handler ref将覆盖默认的AuthenticationSuccessHandler,因此如果您想对authentication SuccessHandler执行一些原始处理,则需要手动执行。ref->您能否告诉我何时调用身份验证成功处理程序ref?。或者我需要手动调用吗?实际上,authentication success handler ref将覆盖默认的AuthenticationSuccessHandler,因此如果您想对authentication SuccessHandler执行一些原始处理,则需要手动执行。参考--->