Spring встроенный LDAP с LdapTemplate

В spring, как внедрено ldap можно использовать с spring-ldap Template. В настоящее время моя конфигурация -

<?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.


person Ravi Kumar    schedule 10.03.2013    source источник


Ответы (2)


Порт встроенного сервера ldap по умолчанию равен 33389, см. соответствующий исходный код.

person zagyi    schedule 10.03.2013
comment
Спасибо, это то, что я искал. Я прочитаю код. Требуется ли ApacheDS в качестве зависимости? - person Ravi Kumar; 11.03.2013

Вы можете выбрать порт, используя атрибут port элемента ldap-server. См. пространство имен . приложение в справочном руководстве. Это также дает значение по умолчанию.

person Shaun the Sheep    schedule 10.03.2013
comment
Я не знал, что могу указать номер порта. Спасибо. - person Ravi Kumar; 12.03.2013