成功验证后,Spring安全性不会达到default-target-url [英] Spring security not hitting default-target-url after successful authtication
问题描述
我已在我的应用程序中实现了spring-security,我的spring-security.xml具有以下form-login标记。
I have implemented spring-security in my application, my spring-security.xml has following form-login tag.
<form-login login-page="/login.htm" default-target-url="/dashboard.htm"
authentication-failure-url="/login.htm?error=true"
authentication-success-handler-ref="authenticationSuccessHandler" />
我想从/login.htm登录,成功验证后我想让用户点击dashboard.htm 。 Everythig工作得很好,除了成功验证之后它没有点击/dashboard.htm而是点击上下文...但如果我在url中手动输入dashboard.htm那么一切正常......是的..我有authticationSuccessHandler的实现。
I want to login from /login.htm and after successful authetication I want user to hit dashboard.htm. Everythig is working fine except for the fact that after successfull authetication it doesn't hit /dashboard.htm but hits the context..but if I manually type dashboard.htm in url then everything works fine...Yes..I have the implementation of authticationSuccessHandler.
推荐答案
尝试删除 default-target-url
属性并添加以下内容:
Try removing the default-target-url
attribute and add the following:
<b:bean id="authenticationSuccessHandler" class="com.example.CustomSimpleURLAuthenticationSuccessHandler">
<b:property name="defaultTargetUrl" value="/dashboard.htm"/>
</b:bean>
这篇关于成功验证后,Spring安全性不会达到default-target-url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!