Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring security Spring Security AD LDAP:错误代码1-00000 4DC:LDAPPER:DSID-0C0906E8_Spring Security_Spring Ldap - Fatal编程技术网

Spring security Spring Security AD LDAP:错误代码1-00000 4DC:LDAPPER:DSID-0C0906E8

Spring security Spring Security AD LDAP:错误代码1-00000 4DC:LDAPPER:DSID-0C0906E8,spring-security,spring-ldap,Spring Security,Spring Ldap,我试图从spring security连接Ldap,但出现连接错误。有人能告诉我这个配置有什么问题吗 UsernamePasswordAuthenticationFilter-尝试验证用户时发生内部错误。 org.springframework.security.authentication.InternalAuthenticationServiceException:LDAP处理过程中发生未分类的异常;嵌套异常为javax.naming.NamingException:[LDAP:错误代码1-

我试图从spring security连接Ldap,但出现连接错误。有人能告诉我这个配置有什么问题吗

UsernamePasswordAuthenticationFilter-尝试验证用户时发生内部错误。 org.springframework.security.authentication.InternalAuthenticationServiceException:LDAP处理过程中发生未分类的异常;嵌套异常为javax.naming.NamingException:[LDAP:错误代码1-000004DC:LDAPPER:DSID-0C0906E8,注释:为了执行此操作,必须在连接上完成成功绑定,数据0,v1db1];剩余名称“ou=用户,dc=aaa,dc=bbb,dc=ccc,dc=dddd” 位于org.springframework.security.ldap.authentication.ldapaauthenticationprovider.doAuthentication(ldapaauthenticationprovider.java:191)

配置文件

<sec:authentication-manager alias="myAuthenticationManager">
    <sec:authentication-provider ref="myAuthenticationProvider"/>
</sec:authentication-manager>

<bean id="myAuthenticationProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
    <constructor-arg ref="ldapBindAuthenticator"/>
    <constructor-arg ref="ldapAuthoritiesPopulator"/>
</bean>

<bean id="ldapBindAuthenticator" class="org.springframework.security.ldap.authentication.BindAuthenticator">
    <constructor-arg ref="contextSource" />
    <property name="userSearch" ref="userSearch"/>
</bean>

<bean id="userSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
    <constructor-arg index="0" value="ou=Users,dc=aaa,dc=bbb,dc=ccc,dc=dddd"/>
    <constructor-arg index="1" value="(sAMAccountName={0})"/>
    <constructor-arg index="2" ref="contextSource"/>
    <property name="searchSubtree" value="true"/>
</bean>

<bean id="ldapAuthoritiesPopulator" class="com.xxxx.MyLdapAuthoritiesPopulator">
    <property name="userDao" ref="userDao"/>
</bean>

<bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
    <constructor-arg value="ldaps://aaa.com:123/DC=aa,DC=bb,DC=cc,DC=dd"/>
    <property name="base" value="DC=aa,DC=bb,DC=cc,DC=dd" />
    <!-- <property name="anonymousReadOnly" value="true"/> -->

</bean>

假设用户试图使用用户名XXX和密码YYY登录。LDAP身份验证通常是这样工作的:

  • 使用技术帐户绑定到LDAP
  • 搜索用户名为XXX=>get-his-DN的用户
  • 尝试使用找到的DN和密码YYY绑定到LDAP
  • 您的错误表明您没有正确执行第一步(技术帐户绑定)

    尝试将userDn和密码添加到您的上下文源(这来自):


    Hi,很抱歉调试旧线程。但我正在尝试理解此LDAP过程。我正在使用liferay和LDAP。请您理解第1点“使用技术帐户绑定到LDAP”好吗?这必须是一个单独的帐户吗?我们不能使用相同的用户名XXX发送请求,并绑定和获取其他详细信息吗?我已经发布了一个关于这个问题的问题,任何关于这个问题的建议都会很有帮助。谢谢
    <bean id="contextSource"
            class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
        <constructor-arg value="ldap://monkeymachine:389/dc=springframework,dc=org"/>
        <property name="userDn" value="cn=manager,dc=springframework,dc=org"/>
        <property name="password" value="password"/>
    </bean>