Results 1 to 4 of 4

Thread: authentication exception while accessing active directory via spring ldap

  1. #1
    Join Date
    Jul 2009
    Location
    Lebanon
    Posts
    9

    Default authentication exception while accessing active directory via spring ldap

    Hello,

    i got this exception while attempting to access windows active directory and retrieve list of users Exception in thread "main" org.springframework.ldap.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 525, v893
    is there any thing wrong in the bean factory :

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    <beans>
    <!-- using an instance of LdapContextSource to manage
    connection to -->
    <bean id="contextSource"
    class="org.springframework.ldap.core.support.LdapC ontextSource">
    <property name="url" value="ldap://corporate:389" />
    <property name="base" value="dc=dcsoft,dc=local" />
    <property name="userDn" value="CN=test LName=test,DC=dcsoft,DC=local" />
    <property name="password" value="test" />
    </bean>
    <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
    <constructor-arg ref="contextSource" />
    </bean>
    <bean id="ldapContact"
    class="com.javaworld.sample.LDAPContactDAO">
    <property name="ldapTemplate" ref="ldapTemplate" />
    </bean>
    </beans>

    thanks

  2. #2
    Join Date
    Jul 2005
    Location
    Helsingborg, Sweden
    Posts
    504

    Default

    <property name="userDn" value="CN=test LName=test,DC=dcsoft,DC=local" />
    It looks like there is a comma missing in the above DN. Try this:

    Code:
    <property name="userDn" value="CN=test,LName=test,DC=dcsoft,DC=local" />
    Ulrik Sandberg
    Jayway (www.jayway.com)
    Spring LDAP project member

  3. #3
    Join Date
    Jul 2009
    Location
    Lebanon
    Posts
    9

    Default fine,,,

    Hi ulsa,
    things went fine like this with the help of ldap browser
    <property name="userDn" value="CN=test test,CN=Users,DC=dcsoft,DC=local" />

    but i encountered a new exception:
    org.springframework.ldap.PartialResultException: Unprocessed Continuation Reference(s); nested exception is javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name ''

    and the SIIMPLE function that generated the exception is the following:
    public List getAllContactNames() {
    System.out.println("we are in getAllContactNames() method");
    // return ldapTemplate.list("DC=dcsoft.local");
    try {
    return ldapTemplate.search("", "(objectclass=person)",
    new AttributesMapper() {
    public Object mapFromAttributes(Attributes attrs)
    throws NamingException {
    return attrs.get("cn").get();
    }
    });
    }
    catch (Exception e) {
    System.out.println("we are in catch block :::");
    e.printStackTrace();
    return ldapTemplate.list("DC=dcsoft,DC=local");
    }
    }
    public List getAllContactNames() {
    System.out.println("we are in getAllContactNames() method");
    try {
    return ldapTemplate.search("", "(objectclass=person)",
    new AttributesMapper() {
    public Object mapFromAttributes(Attributes attrs)
    throws NamingException {
    return attrs.get("cn").get();
    }
    });
    }
    catch (Exception e) {
    System.out.println("we are in catch block :::");
    e.printStackTrace();
    return ldapTemplate.list("DC=dcsoft,DC=local");
    }
    }
    Solution is always there u have to find it

  4. #4
    Join Date
    Jun 2007
    Location
    Vienna, Austria
    Posts
    68

    Default

    Quote Originally Posted by Rida View Post
    but i encountered a new exception:
    org.springframework.ldap.PartialResultException: Unprocessed Continuation Reference(s); nested exception is javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name ''
    In the installation of one of our customers we got such an exception when authenticating an user with Spring Security and LDAP. The LDAP system was an Active Directory and was using a referral (or continuation reference).

    In our case we used a DefaultSpringSecurityContextSource and we set the property referral to "follow". We also had to apply the modification from http://forum.springsource.org/showthread.php?t=71028 to SpringSecurityLdapTemplate get things working.

    I'am not sure if this can be applied to your situation, but I hope it will give you a hint. Perhaps reading the posts with "referral" will give you further hints.

    Martin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •