2
我已经使用Spring Security创建了一个应用程序。在春季安全上下文文件我已经添加了下面的一段代码:注销Spring Security不起作用
<http auto-config="true">
<intercept-url pattern="/index.jsp" access="ROLE_ADMIN" />
<intercept-url pattern="/metrics.jsp#chart" access="ROLE_ADMIN" />
<intercept-url pattern="/metrics.jsp" access="ROLE_ADMIN" />
<intercept-url pattern="/j_spring_security_logout#chart" access="ROLE_ADMIN" />
<form-login login-page="/login.jsp" authentication-failure-url="/loginerror.jsp" default-target-url="/index.jsp" />
<logout logout-success-url="/login.jsp" invalidate-session="true" delete-cookies="JSESSIONID" />
</http>
在我加入以下代码的应用程序上下文文件:
<bean id="webContentInterceptor" class="org.springframework.web.servlet.mvc.WebContentInterceptor">
<property name="cacheSeconds" value="0" />
<property name="useExpiresHeader" value="true" />
<property name="useCacheControlHeader" value="true" />
<property name="useCacheControlNoStore" value="true" />
</bean>
在应用程序的页面(我用JSP),我已经添加了注销按钮下面的代码:
<a href="j_spring_security_logout" class="ui-btn-right">Logout</a>
那么,当用户点击该按钮时,他将被重定向到登录页面,但他仍然可以去其他页面这是不应该发生的,有谁知道问题出在哪里?我错过了什么吗?提前致谢!
不是应该' devnull
@devnull,我们在同一时间回答:)。我已经在这里回答了类似的问题http://stackoverflow.com/questions/16391219/how-to-log-out-using-spring-security/16391485#16391485 – Michael
伙计们,我添加了/符号:仍然是相同的行为 – Anto