2012-03-15 3 views
3

Я использую Spring 3.1, и я делаю LDAP в первый раз.Spring Security 3.1 и Right Jars

Вот мой * -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> 

Я начал с этим банки, связанные с безопасностью в моем 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 

И я получил сообщение об ошибке:

org.springframework.context.ApplicationContextException: Не удалось найти: org.springframework.ldap.core.support.BaseLdapPathCo ntextSource.
Если вы используете LDAP с Spring Security, , пожалуйста, убедитесь, что вы включили файл приложения spring-ldap в приложение; вложенной исключение составляет java.lang.ClassNotFoundException: org.springframework.ldap.core.support.BaseLdapPathContextSource

Итак, я добавил еще банки, чтобы импровизировать быть этот набор файлов безопасности:

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 

это заставило меня глубже даже больше сообщений об ошибках:

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 

Я ловила на много вещей, обучение Maven не в моем списке, но я не Там еще нет. Любые советы по получению правильных микшерных баннеров для базовой аутентификации LDAP с помощью Spring 3.1?

Я попытался загрузить всю весну 3.1.1 dist, весь Spring LDAP 1.3.1 dist и весь Spring Security 3.1.0 dist. У меня есть все. Поэтому я не понимаю, как это проблема с зависимостью, FWIW.

+1

org.springframework.ldap.core.support.BaseLdapPathContextSource находится внутри пружинной безопасности Ldap баночки. Возможно, это не проблема с jar, а classpath.Просмотрите свой путь к классам – jddsantaella

+0

jddsantaella, как бы это была проблема с classpath? Все упомянутые баночки были в моем каталоге war/WEB-INF/lib. Благодарю. – Steve

+0

Я попытался загрузить весь Spring 3.1.1 dist, весь Spring LDAP 1.3.1 dist и весь Spring Security 3.1.0 в мою войну/WEB-INF/lib. У меня есть все. Поэтому я не понимаю, как это проблема с зависимостью, FWIW. – Steve

ответ

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

Те 3 должно быть достаточно, и они будут тянуть их dependendies, если вы используете Maven или подобный инструмент.

Если нет, вам нужно пройти все 3 библиотеки и скопировать все их зависимости, а также в свой путь к классам.

Dependency graph

+0

Как я уже писал, я много изучаю. Мейвен в моем списке. Но я еще не там. Любые предложения по поиску зависимостей для этих трех банок без использования Maven? Благодарю. – Steve

+0

Я нашел этот список зависимостей. Я дам всем знать, если это трюк: [link] (http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#appendix-dependencies) – Steve

+0

см. Выше для графика зависимости. Вы должны начать использовать maven, упростите для вас несколько вещей о зависимостях. – fmucar

2

Проверить эту нить Moved to Spring 3.1.1 from Spring 3.0.5 now my App does not work

Как Ryan-Stewart утверждает:

Blockquote пружинными LDAP не входит в базовую весной 3,1 дистрибутивом. Фактически, его версия полностью разделена, и в настоящее время она находится в версии 1.3.1.

Вам необходимо скачать дополнительные банки из here

Все Заслуга ryan-stewart

Смежные вопросы