【问题标题】:Spring embedded LDAP with LdapTemplate带有 LdapTemplate 的 Spring 嵌入式 LDAP
【发布时间】:2013-02-25 21:35:45
【问题描述】:

中,如何嵌入可以与模板一起使用。目前,我的配置是 -

<?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 值中指定的默认端口是什么。

【问题讨论】:

    标签: spring ldap spring-ldap java spring spring-security spring-ldap


    【解决方案1】:

    内嵌ldap服务器的端口默认为33389,见相关source code

    【讨论】:

    • 谢谢,这就是我要找的。我将通读代码。它是否需要 ApacheDS 作为依赖项?
    【解决方案2】:

    您可以使用ldap-server 元素的port 属性选择端口。请参阅参考手册中的namespace appendix。这也给出了默认值。

    【讨论】:

    • 我不知道我可以指定端口号。谢谢。
    猜你喜欢
    • 2022-10-21
    • 2012-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-07
    • 2015-04-18
    • 2017-09-14
    相关资源
    最近更新 更多