0
votes

I have got a problem with my spring-security.xml file

<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"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
                    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                    http://www.springframework.org/schema/jdbc
                    http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
                    http://www.springframework.org/schema/security
                    http://www.springframework.org/schema/security/spring-security-3.2.xsd">

<beans:http auto-config="true" use-expressions="true">
    <beans:intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" />
    <beans:intercept-url pattern="/user**" access="hasRole('ROLE_USER')" /><!-- 
        access denied page -->
    <beans:access-denied-handler error-page="/403" />
    <beans:form-login login-page="/login" authentication-failure-url="/login?error"
        username-parameter="username" password-parameter="password" />
    <beans:logout logout-success-url="/login?logout" /><!-- enable csrf protection -->
    <beans:csrf />
</beans:http>
<beans:authentication-manager>
    <beans:authentication-provider user-service-ref="loginService" />
</beans:authentication-manager>

And here is an error

cvc-complex-type.2.4.a: Invalid content was found starting with element 'beans:http'. One of ...(i can't post more then 2 links) is expected.

What the problem? Help pls!

1

1 Answers

0
votes

remove the <beans:

<http auto-config="true" use-expressions="true">
    <intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" />
    <intercept-url pattern="/user**" access="hasRole('ROLE_USER')" /><!-- 
        access denied page -->
    <access-denied-handler error-page="/403" />
    <form-login login-page="/login" authentication-failure-url="/login?error"
        username-parameter="username" password-parameter="password" />
    <logout logout-success-url="/login?logout" /><!-- enable csrf protection -->
    <csrf />
</http>
<authentication-manager>
    <authentication-provider user-service-ref="loginService" />
</authentication-manager>