Spring Security 4.2.4 LDAP认证

时间:2018-09-20 16:52:16

标签: spring-security ldap

我拥有Spring Security,并且希望将其与LDAP集成。我正在尝试使用.ldif fila模拟ldap服务器,如许多教程中所述。这是我的pom:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-ldap</artifactId>
    <version>4.2.4.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.ldap</groupId>
    <artifactId>spring-ldap-core</artifactId>
    <version>2.3.2.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.5.6</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.6</version>
</dependency>
<dependency>
    <groupId>org.apache.directory.server</groupId>
    <artifactId>apacheds-all</artifactId>
    <version>1.5.4</version>
    <scope>test</scope>
</dependency>

这是我的应用程序上下文安全性:

<ldap-server ldif="classpath:user.ldif" port="33389"/>

<authentication-manager erase-credentials="false">
    <!-- <authentication-provider ref="customAuthenticationProvider" /> -->
    <ldap-authentication-provider
        group-search-filter="member={0}"
        group-search-base="ou=groups"
        user-search-base="ou=people"
        user-search-filter="uid={0}" />
    <authentication-provider>
        <user-service>
            <user name="FB12345" password="FB12345" authorities ="TEAM LEADER" />
        </user-service>
    </authentication-provider>
</authentication-manager>

启动应用程序时出现此错误:

Error creating bean with name 'org.springframework.security.apacheDirectoryServerContainer': Failed to introspect bean class [org.springframework.security.ldap.server.ApacheDSContainer] for lookup method metadata: could not find class that it depends on; nested exception is java.lang.NoClassDefFoundError: org/apache/directory/server/core/partition/Partition

但是该类存在,如果我执行ctrl + shift + T并查找分区,我可以看到它,我可以在apacheds-1.5.4 jar中的org.apache.directory.server.core.partition内部看到该类。

我尝试使用许多版本的apappeds,但没有任何效果

怎么了。 谢谢

0 个答案:

没有答案