Results 1 to 4 of 4

Thread: Spring Ldap - User Authentication

  1. #1
    Join Date
    May 2009
    Posts
    10

    Default Spring Ldap - User Authentication

    Hi,

    I am trying to authenticate a user with his userid and password through Active Directory. I do not know to which group the user belongs and also dont know the whole CN or DN. Is there a way through Spring LDAP that we can authenticate a user just based on their user name (sAmAccountName) and password.

    Thanks for your help.

  2. #2
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    Using with the sAMAccountName you can construct a filter which will uniquely give you a single entry. Use this filter as input to one of the authenticate methods of LdapTemplate and you should be all set.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  3. #3
    Join Date
    May 2009
    Posts
    10

    Default

    Hi Rasky,

    Thanks for your inputs. I tried below code but its giving me an error. The problem seems to be bcoz of missing group name. Is there any wild card characters that I can use to allow it to check all the existing groups in AD?

    ldapTemplate.authenticate("", ("sAMAccountName=<userid>"), "<password>")

    Error occured javax.naming.PartialResultException: Unprocessed Continuation Reference(s); Remaining name: '/'
    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.convert LdapException(LdapUtils.java:203)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:315)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:237)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:624)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:535)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:462)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:483)
    at org.springframework.ldap.core.LdapTemplate.search( LdapTemplate.java:503)
    at org.springframework.ldap.core.LdapTemplate.authent icate(LdapTemplate.java:1424)
    at org.springframework.ldap.core.LdapTemplate.authent icate(LdapTemplate.java:1410)
    at org.springframework.ldap.core.LdapTemplate.authent icate(LdapTemplate.java:1397)
    at com.example.dao.PersonDaoImpl.auth(PersonDaoImpl.j ava:53)
    at com.example.dao.MainClass.main(MainClass.java:19)

  4. #4
    Join Date
    Apr 2008
    Posts
    15

Tags for this Thread

Posting Permissions

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