编程语言
首页 > 编程语言> > java – 使用LdapTemplate的Spring嵌入式LDAP

java – 使用LdapTemplate的Spring嵌入式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值中指定什么默认端口.

解决方法:

嵌入式ldap服务器的端口默认为33389,请参阅相关的source code.

标签:java,spring,spring-security,spring-ldap,spring,ldap,spring-ldap
来源: https://codeday.me/bug/20190723/1510263.html