Spring 3.1 - Deprecated warnings in XML configuration file
Hi all,
I am trying to migrate Spring Security in a Web application from 3.0.7 to 3.1.
Everything is fine, however in STS 2.8.1 I receive a bunch of Warnings in the Security XML configuration file.
These are the warnings:
- Method 'setAuthenticationEntryPoint' is marked deprecated
- Method 'setAuthenticationManager' is marked deprecated
- Method 'setKey' is marked deprecated
- Method 'setLoginFormUrl' is marked deprecated
- Method 'setRequestCache' is marked deprecated
- Method 'setSecurityContextRepository' is marked deprecated
- Method 'setSessionAuthenticationStrategy' is marked deprecated
- Method 'setUserAttribute' is marked deprecated
Here is the file:
Code:
<?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.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<beans:bean class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler" />
<global-method-security secured-annotations="enabled" />
<http auto-config="true" access-denied-page="/accessDenied">
<form-login login-page="/login" default-target-url="/log/viewLogs" authentication-failure-url="/login?login_error=1" />
<logout logout-success-url="/logout" />
<session-management invalid-session-url="/login">
<concurrency-control max-sessions="1" expired-url="/sessionTimeout" error-if-maximum-exceeded="true" />
</session-management>
<http-basic />
<anonymous enabled="true" granted-authority="ROLE_ANONYMOUS" username="Anonymous_User" />
<intercept-url pattern="/log/**" access="ROLE_USER,ROLE_ADMIN" />
</http>
</beans:beans>
Any idea what I am missing the configuration or what I did wrong? The warnings were not there in Spring Security 3.0.7.
Thanks a lot.
Paul
Same problems as everyone else
I've tried just about every combination of things to get rid of those warnings, and they won't go away. They are the only warnings in my entire project, so it's quite frustrating. Here's what I get. My security.xml looks like this (using security 3.1 xsd):
<sec:http auto-config="true" use-expressions="true">
<sec:form-login login-processing-url="/resources/j_spring_security_check" login-page="/login" authentication-failure-url="/login?login_error=t" />
<sec:logout logout-url="/resources/j_spring_security_logout" />
<sec:intercept-url pattern="/favicon.ico" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<sec:intercept-url pattern="/join/**" access="isAuthenticated()"/>
<sec:intercept-url pattern="/sampleflow/**" access="hasRole('ROLE_ADMIN')" />
<sec:intercept-url pattern="/imp/**" access="hasRole('ROLE_IMPAIRMASTER')" />
<sec:intercept-url pattern="/resources/**" access="permitAll" />
<sec:intercept-url pattern="/**" access="permitAll" />
</sec:http>
<sec:ldap-server id="contextSource"
url="${ldap.url}"
manager-dn="${ldap.userDn}"
manager-password="${ldap.password}"/>
<sec:authentication-manager>
<sec:ldap-authentication-provider
user-dn-pattern="uid={0},ou=people"
group-search-filter="uniqueMember={0}"
group-search-base="ou=groups"/>
<sec:authentication-provider user-service-ref="localUsers"/>
</sec:authentication-manager>
<sec:user-service id="localUsers">
<sec:user name="admin" password="passw0rd" authorities="ROLE_ADMIN, ROLE_IMPAIRMASTER"/>
</sec:user-service>
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
<constructor-arg ref="contextSource" />
</bean>
And here are the warnings I get:
Method 'setAuthenticationEntryPoint' is marked deprecated
Method 'setAuthenticationManager' is marked deprecated
Method 'setKey' is marked deprecated
Method 'setLoginFormUrl' is marked deprecated
Method 'setRequestCache' is marked deprecated
Method 'setSecurityContextRepository' is marked deprecated
Method 'setSessionAuthenticationStrategy' is marked deprecated
Method 'setUserAttribute' is marked deprecated
Referenced bean 'contextSource' not found
Referenced bean 'org.springframework.security.securityContextSourc e' not found
Referenced bean 'org.springframework.security.securityContextSourc e' not found