首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >GWT / EXT + Spring安全应用中的双重认证

GWT / EXT + Spring安全应用中的双重认证
EN

Stack Overflow用户
提问于 2012-01-20 12:10:06
回答 2查看 629关注 0票数 1

我对双重认证有问题。我已经通过弹出窗口实现了身份验证表单,该窗口总是在顶部。但是,我可能对导致Tomcat在应用程序开始之前就提出身份验证请求的拦截器有问题:

用户名和密码是由http://127.0.0.1:8888请求的。网站上写着:"Spring安全应用程序“

如果禁用拦截器,我会在日志中看到SecurityContextHolder将用户视为匿名者。

所以我的问题是:我能以某种方式禁用第一个Tomcat登录屏幕吗?

我的Spring安全配置XML是:

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?>
<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-3.0.xsd
                                 http://www.springframework.org/schema/security 
                                 http://www.springframework.org/schema/security/spring-security-3.0.xsd">


<authentication-manager alias="authenticationManager">
    <authentication-provider ref="customAuthenticationProvider"/>
</authentication-manager>

<beans:bean id="customAuthenticationProvider" class="com.myCompany.model.security.CustomAuthenticationProvider" >
    <beans:property name="databaseId"    value="${configuration.databaseId}" />
    <beans:property name="applicationId" value="${configuration.applicationId}" />
</beans:bean>

<http auto-config="true" >
        <intercept-url pattern="/myApp/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
        <intercept-url pattern="/MyApp.html*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
        <intercept-url pattern="/gwt/**" access="ROLE_USER"/>
        <intercept-url pattern="/**/*.html" access="ROLE_USER"/>

        <intercept-url pattern="/css/**" filters="none"/>
        <intercept-url pattern="/**" access="ROLE_USER" />

        <http-basic />  
</http>

<global-method-security secured-annotations="enabled" />

</beans:beans>
EN

回答 2

Stack Overflow用户

发布于 2013-03-26 13:42:47

如果我以正确的方式理解您的问题,您就会遇到双重身份验证问题,例如Tomcat身份验证或Apache和Spring身份验证机制。

在上一个项目中,我遇到了和Spring安全机制的问题。在启动之前,我的任务是通过一个简单的来“保护”对站点的访问。通过在Application中启用它,Spring也开始执行相同的操作:“”一直在显示

此行为的解决方案是禁用-config

代码语言:javascript
运行
复制
<security:http auto-config="false" ...>
    ...
</security:http>
票数 1
EN

Stack Overflow用户

发布于 2012-08-21 19:37:34

你的问题不太清楚。您提到了Tomcat登录屏幕,我认为它是web应用程序的第一个屏幕,允许用户登录。

如果这是正确的,并且您的登录页面是命名的,比如login.html,那么您所要做的就是配置拦截器以允许匿名访问该页面-

代码语言:javascript
运行
复制
<intercept-url pattern="/**/login.*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<intercept-url pattern="/gwt/**" access="ROLE_USER"/>
<intercept-url pattern="/**/*.html" access="ROLE_USER"/>

<intercept-url pattern="/css/**" filters="none"/>
<intercept-url pattern="/**" access="ROLE_USER" />
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8941248

复制
相关文章

相似问题

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