在spring中,如何嵌入ldap可與spring-ldap模板一起使用。目前,我的配置是 -用LdapTemplate彈出嵌入式LDAP
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
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.0.xsd">
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
<property name="url" value="${PROVIDER_URL}" />
<property name="base" value="${Search_Base}" />
<property name="userDn" value="${SECURITY_PRINCIPAL}" />
<property name="password" value="${SECURITY_CREDENTIALS}" />
</bean>
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
<constructor-arg ref="contextSource" />
</bean>
</beans>
ContextSource值在屬性文件中可用。現在我想用嵌入式LDAP -
<security:ldap-server ldif="classpath:sample.ldif" root="cn=mojo"/>
會是怎樣,我將在LdapContextSource值指定默認端口。
謝謝,多數民衆贊成我正在尋找。我將通讀代碼。它需要ApacheDS作爲依賴嗎? – 2013-03-10 20:37:18
是的,它需要Apache DS。請參閱手冊或FAQ。 – 2013-03-10 21:25:38