在基于GWT的web应用程序中实现spring安全性。我找到。 一切正常工作正常,除了以下事实:Spring已经登录用户的安全性重定向问题
我打开login.jsp并给出我的有效用户登录凭据。 提交后,它成功重定向到主页。现在,当我在地址栏中编辑login.jsp的URL ...令人惊讶的是,它允许打开我的login.jsp,但据我的理解..它不应该允许回到login.jsp直到&,除非我已登录。
可能是我的security-context.xml文件没有正确配置。
下面是我的安全应用程序的context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- - Sample namespace-based configuration - -->
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
<global-method-security secured-annotations="enabled">
</global-method-security>
<beans:bean id="customAuthenticationProcessingFilter"
class="edu.authentication.CustomAuthenticationProcessingFilter">
<custom-filter position="AUTHENTICATION_PROCESSING_FILTER" />
<beans:property name="defaultTargetUrl" value="/Home.html?gwt.codesvr=127.0.0.1:9997" />
<beans:property name="authenticationFailureUrl" value="/login.jsp?login_error=1" />
<beans:property name="authenticationManager" ref="authenticationManager" />
</beans:bean>
<beans:bean id="authenticationProcessingFilterEntryPoint"
class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<beans:property name="loginFormUrl" value="/login.jsp" />
<beans:property name="forceHttps" value="false" />
</beans:bean>
<beans:bean id="customUserDetailsService"
class="edu.authentication.CustomUserDetailsService">
<beans:property name="urmService" ref="urmService" />
</beans:bean>
<http auto-config="false" entry-point-ref="authenticationProcessingFilterEntryPoint">
<intercept-url pattern="/login.jsp*" filters="none" />
<intercept-url pattern="/forgot_password.jsp*" filters="none" />
<intercept-url pattern="/forgotPasswordServlet.do*" filters="none" />
<intercept-url pattern="/myApp/**" access="IS_AUTHENTICATED_FULLY"/>
<intercept-url pattern="/gwt/**" access="IS_AUTHENTICATED_FULLY"/>
<intercept-url pattern="/*.html" access="IS_AUTHENTICATED_FULLY"/>
<logout logout-url="/j_spring_security_logout"
invalidate-session="true" logout-success-url="/login.jsp?loggedout=true"/>
</http>
<authentication-manager alias="authenticationManager" />
<authentication-provider user-service-ref="customUserDetailsService">
<password-encoder hash="md5" />
</authentication-provider>
</beans:beans>
任何帮助/建议将是非常appriciable ..
我刚回答[类似的问题在这里](http://stackoverflow.com/a/12602395/7084 34)。 – Xaerxess
只是一个建议,发布代码片段时,尝试编辑原始包名称以隐藏您的真实项目信息。从包名称来看,我想这个配置来自onmobile.com的'Campaign Management'产品 – Adi
可能的重复[如果用户在登录后访问登录页面,如何重定向到主页?](http:// stackoverflow。 COM /问题/ 12597519 /如何对重定向到的 - 主页 - 如果最用户访问,在登录页面,之后的幸福) – krock