简体   繁体   中英

Spring embedded LDAP with LdapTemplate

In , how embedded can be used with Template. Currently, my configuration is -

<?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 values are available in properties file. Now I want to use embedded ldap -

<security:ldap-server ldif="classpath:sample.ldif"  root="cn=mojo"/>

What would be default port that I will specify in LdapContextSource values.

嵌入式ldap服务器的端口默认为33389 ,请参阅相关的源代码

You can choose a port using the port attribute of the ldap-server element. See the namespace appendix in the reference manual. This also gives the default value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM