2

ユーザーの認証中に次の例外が発生します:

Exception in thread "main" org.springframework.ldap.PartialResultException: Unprocessed Continuation Reference(s); nested exception is javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name '/'
    at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:205)

認証方法:

public boolean authenticate(String userName, String password) {
        AndFilter filter = new AndFilter();
        filter.and(new EqualsFilter("objectclass", "person")).and(
                new EqualsFilter("sAMAccountName", userName));
        return ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH, filter
                .toString(), password);
    }

Applicationcontext.xml

<bean id="contextSource"
        class="org.springframework.ldap.core.support.LdapContextSource">
        <property name="url" value="ldap://10.10.10.10:389" />
        <property name="base" value="DC=lab2,DC=ins" />
        <property name="userDn" value="CN=Ldap Bind,OU=Service Accounts,OU=TECH,DC=lab2,DC=ins" />
        <property name="password" value="secret" />
    </bean>
    <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
        <constructor-arg ref="contextSource" />
    </bean>
    <bean id="ldapContact"
        class="ldap.ContactLDAP ">
        <property name="ldapTemplate" ref="ldapTemplate" />
    </bean>

testClass:

Resource r = new ClassPathResource("applicationContext.xml");
        BeanFactory factory = new XmlBeanFactory(r);
        ContactLDAP contact = (ContactLDAP) factory.getBean("ldapContact"); 

        System.out.println(contact.authenticate("username", "secret"));

ここで何が欠けていますか?

4

1 に答える 1

2

を設定して、紹介をフォローしてみてくださいjava.naming.referral=follow

于 2012-08-28T14:32:06.833 に答える