Announcement Announcement Module
Collapse
No announcement yet.
authentication exception while accessing active directory via spring ldap Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    <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" />

    Comment


    • #3
      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");
      }
      }

      Comment


      • #4
        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

        Comment

        Working...
        X