0

我有在tomcat上工作的spring基本身份验证。

当我在 WebLogic 12c 上加载应用程序时,它突然停止工作,一些研究建议我放入<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>域的 config.xml 文件以阻止 WebLogic 拦截 AUTHENTICATE 标头。

如果我通过 ip 地址访问它现在可以工作

//basic spring authentication works
http://123.456.789.111/mycontext

但不是通过本地主机

//can no longer login to the application
http://localhost/mycontext

有谁知道我该如何解决这个问题?

更新- 弹簧安全配置

<?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.1.xsd">

  <http pattern="/resources/**" security="none"/>
  <http pattern="/404" security="none"/>

  <http auto-config="true">

        <intercept-url pattern="/login"  access="IS_AUTHENTICATED_ANONYMOUSLY" />
        <intercept-url pattern="/logout" access="IS_AUTHENTICATED_ANONYMOUSLY" />
        <intercept-url pattern="/endpoints/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
        <intercept-url pattern="/**" access="ROLE_USER" />

        <logout logout-success-url="/logout"/>
        <form-login
           login-page="/login"
           authentication-failure-url="/login?login_error=1"
           default-target-url="/dashboard" 
           always-use-default-target='true'/>
  </http>



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

</beans:beans>
4

0 回答 0