成功登录后使用Spring Security导航到其他GWT模块
我有一个GWT应用程序,由两个模块组成:“应用程序”用于主要功能,“登录”用于登录/忘记密码/注册新用户功能 我正在使用Spring Security在成功登录时将用户重定向到Application.html:成功登录后使用Spring Security导航到其他GWT模块,gwt,spring-security,Gwt,Spring Security,我有一个GWT应用程序,由两个模块组成:“应用程序”用于主要功能,“登录”用于登录/忘记密码/注册新用户功能 我正在使用Spring Security在成功登录时将用户重定向到Application.html: <security:http auto-config="true"> <security:intercept-url pattern="/Application.html**" access="ROLE_USER"/> <security:i
<security:http auto-config="true">
<security:intercept-url pattern="/Application.html**" access="ROLE_USER"/>
<security:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<security:form-login login-page="/Login.html" default-target-url="/MainApplication.html"
always-use-default-target="true" authentication-failure-url="/Login.html?failed=true"/>
</security:http>
通过Login.html成功进行用户身份验证后,加载Application.html模块并向服务器执行相应的请求,但浏览器内容保持不变,地址栏中的URL仍然是“Login.html”
所以,问题是:为什么不发生重定向
提前谢谢 您正在通过SpringSecurityFilter拦截Application.html,目标URL被指定为MainApplication.html。在mainApplication.html中,尝试将
<meta http-equiv="REFRESH" content="0;url=Application.html">
因此,它会将您移回Application.html。如果需要,您可以在这里进行一些授权。还可以检查您的web.xml中是否正确设置了DelegatingFilterProxy
我的配置如下。我使用GWT应用程序
在我的jsp中
<form name="login" action="<c:url value="j_spring_security_check"/>" method="POST">
在my web.xml中
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
在my welcome.jsp中
<sec:authorize ifAnyGranted="<%=gRoles%>">
<meta http-equiv="REFRESH" content="0; url=demoApp/demoApp.jsp">
</sec:authorize>
spring-security.xml
<http auto-config="false" access-denied-page="/login.jsp?error=Access%20Denied">
<intercept-url pattern="/login.jsp*" filters="none" />
<intercept-url pattern="/demoApp/**" access="${app.roles}" />
<form-login login-page="/login.jsp"
default-target-url="/welcome.jsp"
always-use-default-target="true"
authentication-failure-url="/login.jsp?error=true" />
<logout logout-success-url="/login.jsp"/>
<anonymous/>
您正在通过SpringSecurityFilter拦截Application.html,目标URL被指定为MainApplication.html。在mainApplication.html中,尝试将
<meta http-equiv="REFRESH" content="0;url=Application.html">
因此,它会将您移回Application.html。如果需要,您可以在这里进行一些授权。还可以检查您的web.xml中是否正确设置了DelegatingFilterProxy
我的配置如下。我使用GWT应用程序
在我的jsp中
<form name="login" action="<c:url value="j_spring_security_check"/>" method="POST">
在my web.xml中
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
在my welcome.jsp中
<sec:authorize ifAnyGranted="<%=gRoles%>">
<meta http-equiv="REFRESH" content="0; url=demoApp/demoApp.jsp">
</sec:authorize>
spring-security.xml
<http auto-config="false" access-denied-page="/login.jsp?error=Access%20Denied">
<intercept-url pattern="/login.jsp*" filters="none" />
<intercept-url pattern="/demoApp/**" access="${app.roles}" />
<form-login login-page="/login.jsp"
default-target-url="/welcome.jsp"
always-use-default-target="true"
authentication-failure-url="/login.jsp?error=true" />
<logout logout-success-url="/login.jsp"/>
<anonymous/>
谢谢您的回复。我在web.xml中检查了spring安全性——它和您的一样,似乎是正确的。我已经按照您的建议添加了标记,并得到了无限循环-Application.html将重定向发送到Login.html,它将重定向发送回Application.html,依此类推。它的行为方式与spring security在加载“应用程序”模块期间拒绝某个地方的访问完全相同,但我确信授权一切正常-我已降低了安全配置以启用对所有资源的匿名访问,并为其打开了调试日志记录。@Valrog如果您得到了解决方案,请记录您的答案。谢谢您的回复。我在web.xml中检查了spring安全性——它和您的一样,似乎是正确的。我已经按照您的建议添加了标记,并得到了无限循环-Application.html将重定向发送到Login.html,它将重定向发送回Application.html,依此类推。它的行为方式与spring security在加载“应用程序”模块期间拒绝某个地方的访问完全相同,但我确信授权一切正常-我降低了安全配置以启用对所有资源的匿名访问,并打开了调试日志记录。@Valrog如果您得到了解决方案,请记录您的答案。