title: Weblogic - Spring Authentication (working via IP address but not via localhost)
body: <p>I have spring basic authentication working on tomcat.</p>
  
  <p>When I loaded the application on WebLogic 12c it suddenly stopped working, some research suggested I put <code>&lt;enforce-valid-basic-auth-credentials&gt;false&lt;/enforce-valid-basic-auth-credentials&gt;</code> in the config.xml file of the domain to stop WebLogic intercepting the AUTHENTICATE header.</p>
  
  <p>It now works if I access via the ip address</p>
  
  <pre><code>//basic spring authentication works
  http://123.456.789.111/mycontext
  </code></pre>
  
  <p>but not via localhost</p>
  
  <pre><code>//can no longer login to the application
  http://localhost/mycontext
  </code></pre>
  
  <p>Does anyone know how I can fix this?</p>
  
  <p><strong>UPDATE</strong> - spring security configuration</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  
    &lt;http pattern="/resources/**" security="none"/&gt;
    &lt;http pattern="/404" security="none"/&gt;
  
    &lt;http auto-config="true"&gt;
  
          &lt;intercept-url pattern="/login"  access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
          &lt;intercept-url pattern="/logout" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
          &lt;intercept-url pattern="/endpoints/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
          &lt;intercept-url pattern="/**" access="ROLE_USER" /&gt;
  
          &lt;logout logout-success-url="/logout"/&gt;
          &lt;form-login
             login-page="/login"
             authentication-failure-url="/login?login_error=1"
             default-target-url="/dashboard" 
             always-use-default-target='true'/&gt;
    &lt;/http&gt;
  
  
  
    &lt;authentication-manager alias="authenticationManager"&gt;
      &lt;authentication-provider&gt;
        &lt;user-service&gt;
          &lt;user name="test" password="pass" authorities="ROLE_USER" /&gt;
        &lt;/user-service&gt;
      &lt;/authentication-provider&gt;
    &lt;/authentication-manager&gt;
  
  &lt;/beans:beans&gt;
  </code></pre>