我对双重认证有问题。我已经通过弹出窗口实现了身份验证表单,该窗口总是在顶部。但是,我可能对导致Tomcat在应用程序开始之前就提出身份验证请求的拦截器有问题:
用户名和密码是由http://127.0.0.1:8888请求的。网站上写着:"Spring安全应用程序“
如果禁用拦截器,我会在日志中看到SecurityContextHolder将用户视为匿名者。
所以我的问题是:我能以某种方式禁用第一个Tomcat登录屏幕吗?
我的Spring安全配置XML是:
<?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>
发布于 2013-03-26 13:42:47
如果我以正确的方式理解您的问题,您就会遇到双重身份验证问题,例如Tomcat身份验证或Apache和Spring身份验证机制。
在上一个项目中,我遇到了和Spring安全机制的问题。在启动之前,我的任务是通过一个简单的来“保护”对站点的访问。通过在Application中启用它,Spring也开始执行相同的操作:“”一直在显示
此行为的解决方案是禁用-config。
<security:http auto-config="false" ...>
...
</security:http>
发布于 2012-08-21 19:37:34
你的问题不太清楚。您提到了Tomcat登录屏幕,我认为它是web应用程序的第一个屏幕,允许用户登录。
如果这是正确的,并且您的登录页面是命名的,比如login.html,那么您所要做的就是配置拦截器以允许匿名访问该页面-
<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" />
https://stackoverflow.com/questions/8941248
复制相似问题