【发布时间】:2019-03-22 13:57:11
【问题描述】:
我有一个 GWT 应用程序,我正在尝试使用 Spring Security 登录。目前,成功登录后,我被重定向回登录页面。我猜这是因为我的 spring 配置和我缺乏 spring 安全知识。
在我的 spring-security.xml 中,我这样定义我的拦截:
<security:http auto-config="true">
<security:intercept-url pattern="/login" access="permitAll" />
<security:intercept-url pattern="/**" access="isAuthenticated()" />
</security:http>
我猜测问题出在 access=isAuthenticated() 上,但我不确定。我希望它重定向到 gwt 页面/应用程序,它将根据返回的角色处理视图。我用这种方法制作了一个非常简单的 gwt 应用程序,并且成功了。
我使用的是 Spring 生成的登录页面,而不是 JSP。
spring-security.xml
<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:b="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
<!-- This is where we configure Spring-Security -->
<security:http auto-config="true">
<security:intercept-url pattern="/login" access="permitAll" />
<security:intercept-url pattern="/**" access="isAuthenticated()" />
</security:http>
<b:bean id="graplAuthentication" class="com.foo.rim.security.GraplAuthentication"/>
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="graplAuthentication" />
</security:authentication-manager>
</b:beans>
【问题讨论】:
标签: gwt spring-security