2010-10-01 4 views
1

je suis Tring à utiliser pour l'authentification ldap dans Weblogic Server, mais je ce problème toujours:LDAP Spring Security sur Weblogic serveur

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#8': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.ldap.core.support.BaseLdapPathContextSource]: Could not convert constructor argument value of type [org.springframework.security.ldap.authentication.LdapAuthenticationProvider] to required type [org.springframework.ldap.core.support.BaseLdapPathContextSource]: Failed to convert value of type 'org.springframework.security.ldap.authentication.LdapAuthenticationProvider' to required type 'org.springframework.ldap.core.support.BaseLdapPathContextSource'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.security.ldap.authentication.LdapAuthenticationProvider] to required type [org.springframework.ldap.core.support.BaseLdapPathContextSource]: no matching editors or conversion strategy found 
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:670) 
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:192) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:984) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:886) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479) 
    Truncated. see log file for complete stacktrace 

Ma sécurité-application context.xml:

<beans:bean id="contextSource" 
      class="org.springframework.security.ldap.DefaultSpringSecurityContextSource"> 
     <beans:constructor-arg value="ldap://127.0.0.1:7001/DC=base_domain"/> 
     <beans:property name="userDn" value="CN=Admin"/> 
     <beans:property name="password" value="weblogic"/> 
    </beans:bean> 

    <beans:bean id="ldapAuthProvider" 
     class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider"> 
     <beans:constructor-arg> 
     <beans:bean class="org.springframework.security.ldap.authentication.BindAuthenticator"> 
     <beans:constructor-arg ref="contextSource"/> 
     <beans:property name="userDnPatterns"> 
      <beans:list><beans:value>uid={0},ou=people</beans:value></beans:list> 
     </beans:property> 
     </beans:bean> 
    </beans:constructor-arg> 
     <beans:constructor-arg> 
     <beans:bean 
     class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator"> 
     <beans:constructor-arg ref="contextSource"/> 
     <beans:constructor-arg value="ou=groups"/> 
     <beans:property name="groupRoleAttribute" value="ou"/> 
     </beans:bean> 
    </beans:constructor-arg> 
    </beans:bean> 
<authentication-manager> 
     <ldap-authentication-provider server-ref="ldapAuthProvider" /> 
    </authentication-manager> 

J'utilise:

<spring.version>3.0.0.RELEASE</spring.version> 
<spring.security.version>3.0.0.RELEASE</spring.version> 

Toute aide sera aprécié,

C'est beaucoup !!!

Vinidog

Répondre

2

<ldap-authentication-provider> configure LdapAuthenticationProvider lui-même, de sorte que vous n'avez pas besoin ldapAuthProvider comme un haricot séparé.

Donc, vous devez utiliser soit <ldap-authentication-provider> comme décrivaient dans le docs:

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

Ou utilisez un fournisseur créé manuellement comme un haricot distinct à l'aide <authentication-provider>:

<authentication-provider ref = "ldapAuthProvider" />. 
Questions connexes