Announcement Announcement Module
Collapse
No announcement yet.
Spring Ldap - User Authentication Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


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

      Comment


      • #4
        http://forum.springsource.org/showth...d=1#post255845

        Comment

        Working...
        X