首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何集成Spring Security和GWT?

如何集成Spring Security和GWT?
EN

Stack Overflow用户
提问于 2009-10-23 01:23:15
回答 7查看 5.9K关注 0票数 17

我正在尝试集成Spring Security和GWT。我还使用了gwt-incubator security。我按照他们的wiki页面上的描述配置了一切。我设法通过intercept-url让安全性工作,但是我不能使用注解让它工作。你知道问题出在哪里吗?

附注:我使用的是Spring2.5.6,Spring Security 2.0.5和gwt-incubator security 1.0.1。欢迎任何有用的链接和评论。

下面是我的配置文件

applicationContext.xml

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?>
<global-method-security secured-annotations="enabled"
    jsr250-annotations="disabled" />
<http auto-config="true">
    <!-- <intercept-url pattern="/**/*.rpc" access="ROLE_USER" /> -->
    <intercept-url pattern="/gwt/**" access="ROLE_USER" />
    <intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
</http>
<authentication-provider>
    <user-service>
        <user name="rod" password="koala"
            authorities="ROLE_SUPERVISOR, ROLE_USER, ROLE_TELLER" />
        <user name="dianne" password="emu" authorities="ROLE_USER,ROLE_TELLER" />
        <user name="scott" password="wombat" authorities="ROLE_USER" />
        <user name="peter" password="opal" authorities="ROLE_USER" />
    </user-service>
</authentication-provider>
<beans:bean id="greetService" class="com.ct.test.server.GreetingServiceImpl" />

web.xml

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<!-- Default page to serve -->
<welcome-file-list>
    <welcome-file>Spring_test.html</welcome-file>
</welcome-file-list>
<!--  Spring related configuration  -->
<listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>
<!-- Initialise the Spring MVC DispatcherServlet -->
<servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<!-- Map the DispatcherServlet to only intercept RPC requests -->
<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/spring_test/greet.rpc</url-pattern>
    <!--
        <url-pattern>/org.example.gwtwisdom.GwtWisdom/services/*</url-pattern>
    -->
</servlet-mapping>
<servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>com.ct.test.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/spring_test/greet.rpc</url-pattern>
</servlet-mapping>
<!-- Spring security -->
<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>

spring-servlet.xml

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?>
<!-- The application context definition for the DispatcherServlet -->
<bean id="urlMapping" class="com.gwtincubator.security.server.GWTSecuredHandler">
    <property name="mappings">
        <map>
            <entry key="/spring_test/greet.rpc" value-ref="greetService" />
        </map>
    </property>
</bean>

下面是我尝试与Spring Security集成的示例项目:http://www.filedropper.com/springtest_1

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1608706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档