Ravi Kumar
Ravi Kumar

Reputation: 1402

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.

Upvotes: 3

Views: 4085

Answers (2)

Shaun the Sheep
Shaun the Sheep

Reputation: 22742

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.

Upvotes: 3

zagyi
zagyi

Reputation: 17518

The port of the embedded ldap server defaults to 33389, see the related source code.

Upvotes: 7

Related Questions