2015-03-30 27 views
6

Ich habe versucht, mein Projekt auf Spring Security 4.0.0 zu aktualisieren. Ich denke, ich habe die migration guide ziemlich ausführlich gelesen, aber selbst wenn ich erfolgreich einloggen und durch die Seiten navigieren kann, bekomme ich 403 Fehler auf alle Ajax Anfragen. Alles funktioniert gut mit 3.2.7.403 Fehler nach dem Upgrade auf Spring Security 4.0.0

Dies ist mein "Handbuch login" Konfigurationsdatei:

<b:beans xmlns:b="http://www.springframework.org/schema/beans" 
    xmlns="http://www.springframework.org/schema/security" 
    xmlns:p="http://www.springframework.org/schema/p" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:util="http://www.springframework.org/schema/util" 
    xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> 

    <!-- HTTP security configurations --> 
    <http use-expressions="true" auto-config='true' disable-url-rewriting="false"> 
     <intercept-url access="permitAll" pattern="/" /><!-- To permit "/" allows the use of web.xml's <welcome-file> --> 
     <intercept-url access="permitAll" pattern="/home" /> 
     <intercept-url access="permitAll" pattern="/login" /> 
     <intercept-url access="permitAll" pattern="/pages/exceptions/**" /> 
     <intercept-url access="permitAll" pattern="/javax.faces.resource/**" /> 
     <intercept-url access="permitAll" pattern="/resources/**" /> 
     <intercept-url access="permitAll" pattern="/j_spring_security_check"/> 
     <intercept-url access="hasRole('ROLE_ADMIN')" pattern="/administration/**" /> 
     <intercept-url access="isAuthenticated()" pattern="/**" /> 
     <logout logout-url="/logout" logout-success-url='/home' /> 
     <form-login login-page='/login' 
      username-parameter="j_username" 
      password-parameter="j_password" 
      login-processing-url="/j_spring_security_check" 
      authentication-failure-url="/login?auth=fail" 
      default-target-url="/home" /> 
    </http> 

    <!-- Configure Authentication mechanism --> 
    <authentication-manager alias="authenticationManager"> 
     <authentication-provider ref="${authentication.provider}" /> 
    </authentication-manager> 

    <b:bean name="bcryptEncoder" 
     class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" /> 

    <b:bean id="daoAuthProvider" 
     class="org.springframework.security.authentication.dao.DaoAuthenticationProvider"> 
     <b:property name="userDetailsService"> 
      <b:bean class="eu.ueb.acem.services.auth.DaoUserDetailsService"> 
       <b:property name="domainService" ref="domainService" /> 
      </b:bean> 
     </b:property> 
     <b:property name="passwordEncoder" ref="bcryptEncoder" /> 
    </b:bean> 

</b:beans> 

Ich versuche zu verwenden:

<http use-expressions="true" auto-config='true' disable-url-rewriting="false"> 
    <headers disabled="true" /> 
    <csrf disabled="true"/> 
    ... 
</http> 

aber ich bekomme:

cvc-complex-type.3.2.2: Attribute 'disabled' is not allowed to appear in element 'headers' 
cvc-complex-type.3.2.2: Attribute 'disabled' is not allowed to appear in element 'csrf' 

die wegen 4.0 normal ist. 0 hat kein dediziertes XML-Schema unter:

http://www.springframework.org/schema/security/

Was also könnte diese "403 verbotenen" Fehler verursachen?

Antwort

12

Ok, ich habe die Lösung gefunden. Es ist in der Tat zu verwenden:

<http use-expressions="true" auto-config='true' disable-url-rewriting="false"> 
    <csrf disabled="true"/> 
    ... 
</http> 

aber für den Augenblick haben wir die XML-Schema-Fehler in Eclipse zu ignorieren. Hoffentlich wird Spring ihr neues Schema bald online stellen.

+0

Vielen Dank für Ihre Meldung. Dies wurde nun behoben. –

+1

@RobWinch Großartig, aber können Sie http://www.springframework.org/schema/security/spring-security.xsd aktualisieren, so dass es auf die neueste Version (4.0) zeigt? –

+0

Sie sind die gleichen Dokumente. Bist du sicher, dass du deinen Cache gelöscht hast? –

Verwandte Themen