【问题标题】:Spring Security in GWTGWT 中的 Spring 安全性
【发布时间】:2013-11-18 08:58:55
【问题描述】:

我用 GWT 尝试了 spring security,它重定向到完美登录。

我停止了服务器并重新启动并尝试访问该 URL。

应用程序不显示登录页面。直接进入首页。

这就是安全性的工作方式,如何使其工作。用户名、密码和角色在spring配置文件中配置。

web.xml

<!-- web.xml -->

<web-app>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/gwtsecuritydemo-security.xml
            /WEB-INF/gwtsecuritydemo-base.xml
        </param-value>
    </context-param>

    <!-- Spring Security Filter Chain -->
    <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>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

    <!-- Servlets -->
    <servlet>
        <servlet-name>greetServlet</servlet-name>
        <servlet-class>au.com.securitydemo.gwt.maven.sample.server.GreetingServiceImpl</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>greetServlet</servlet-name>
        <url-pattern>/gwtsecuritydemo/greet</url-pattern>
    </servlet-mapping>

    <!-- Default page to serve -->
    <welcome-file-list>
        <welcome-file>gwtsecuritydemo.html</welcome-file>
    </welcome-file-list>

</web-app>

弹簧配置。

<!-- Spring Config -->

<http auto-config="true">
    <intercept-url pattern="/*" access="ROLE_USER" />
</http>

<authentication-manager alias="authenticationManager">
    <authentication-provider>
        <user-service>
            <user authorities="ROLE_USER" name="guest" password="guest" />
        </user-service>
    </authentication-provider>
</authentication-manager>

谢谢, 班纳特。

【问题讨论】:

  • 你能发布你的 web.xml 和你的 spring 安全配置的相关部分吗?
  • 请检查编辑部分。

标签: gwt spring-security


【解决方案1】:

您在重新启动期间服务器保留了会话,或者您配置了“记住我的 cookie”。 可以肯定的是,从您的浏览器中删除相关的 cookie(通常是 JSESSIONID 和 REMEMBER_ME)并重新加载页面。

【讨论】:

  • 我不这么认为。我正在使用 tomcat,但我没有配置任何东西来保留会话。
  • 默认情况下,会话在 Tomca 中是持久的。顺便说一句,您是否尝试过删除 cookie?
猜你喜欢
  • 2014-07-20
  • 2012-12-04
  • 2014-07-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-18
  • 1970-01-01
相关资源
最近更新 更多