Spring Security 3.1 and the Right Jars

I am using Spring 3.1 and I am doing LDAP for the first time.

Here is my * -security.xml:

<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 auto-config="true">
    <intercept-url pattern="/welcome*" access="ROLE_USER" />
    <form-login login-page="/login" default-target-url="/welcome"
      authentication-failure-url="/loginfailed" />
    <logout logout-success-url="/logout" />
  </http>

  <ldap-server url = "ldap://ldap-east.abc.acme.org:636/o=acme.org" />

    <authentication-manager>
      <ldap-authentication-provider user-dn-pattern="uid={0},ou=people"/>
    </authentication-manager>

</beans:beans>

      

I started using these security related jars in my lib:

spring-security-ldap-3.1.0.RELEASE.jar
spring-security-config-3.1.0.RELEASE.jar
spring-security-core-3.1.0.RELEASE.jar
spring-security-taglibs-3.1.0.RELEASE.jar
spring-security-web-3.1.0.RELEASE.jar

      

And I got this error message:

org.springframework.context.ApplicationContextException: Could not find: org.springframework.ldap.core.support.BaseLdapPathContextSource.
    If you are using LDAP with Spring Security, make sure you include the spring-ldap jar file in your application; nested exception is java.lang.ClassNotFoundException: org.springframework.ldap.core.support.BaseLdapPathContextSource

So, I added more jars to the lib to be this set of security files:

spring-ldap-core-1.3.1.RELEASE.jar
spring-ldap-core-tiger-1.3.1.RELEASE.jar
spring-security-ldap-3.1.0.RELEASE.jar
spring-security-config-3.1.0.RELEASE.jar
spring-security-core-3.1.0.RELEASE.jar
spring-security-taglibs-3.1.0.RELEASE.jar
spring-security-web-3.1.0.RELEASE.jar

      

This took me even deeper even to the MORE error messages:

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.filterChains': 
Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' 
while setting bean property 'sourceList' with key [0]; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': 
Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' 
while setting constructor argument with key [2]; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0':
Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' w
hile setting bean property 'authenticationManager'; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': 
Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' 
while setting constructor argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': 
FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.authenticationManager': 
Cannot resolve reference to bean 'org.springframework.security.ldap.authentication.LdapAuthenticationProvider#0' 
while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.ldap.authentication.LdapAuthenticationProvider#0': 
Cannot create inner bean '(inner bean)' of type [org.springframework.security.ldap.authentication.BindAuthenticator] 
while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name '(inner bean)#17': Cannot resolve reference to bean 'org.springframework.security.securityContextSource' 
while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.securityContextSource': 
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: 
Could not instantiate bean class [org.springframework.security.ldap.DefaultSpringSecurityContextSource]: 
Constructor threw exception; nested exception is java.lang.NoClassDefFoundE

      

I am catching up with a lot of things by learning Maven on my list, but I am not there yet. Any tips for getting the right mixing tanks for basic LDAP authentication with Spring 3.1?

I tried downloading all of Spring 3.1.1 dist, all of Spring LDAP 1.3.1 dist, and all of Spring 3.1.0 security layer. I have everything. So I don't understand how this is a dependency issue, FWIW.

+3


source to share


2 answers


spring-security-config
spring-security-taglibs
spring-security-ldap

      

Those 3 should be enough and they will pull their dependencies if you are using maven or a similar tool.



If it is not, you need to go through all 3 libraries and copy all their dependencies into your classpath.

Dependency graph

+7


source


Check this thread Moved to Spring 3.1.1 from Spring 3.0.5 now my application is not working

As ryan-stewart says:

Blockquote spring-ldap is not included in the base Spring 3.1 distribution. In fact, its version is completely split and it is currently in version 1.3.1.



You need to download additional jars from here

Ryan-stewart is credited to everyone

+2


source







All Articles