0

Good Day,

I am trying to connect MS Active directory using Spring boot but getting following error:

[LDAP: error code 32 - 0000208D: NameErr: DSID-0310021B, problem 2001 (NO_OBJECT), data 0, best match of: '' ]; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-0310021B, problem 2001 (NO_OBJECT), data 0, best match of: '' ]; remaining name '/'

       auth
            .ldapAuthentication()
            // User Base DN
            //.userDnPatterns("cn={0},dc=in,dc=com
            //.userDnPatterns("uid={0},ou=people")
            .userDnPatterns("cn=users,dc=in,dc=com")
            //.userSearchFilter("(sAMAccountName={0})")
            .userSearchFilter("(objectClass=person)")
            .contextSource()
            //ldap server
            .url("ldap://ldap1:389")
            // Bind credentials Bind Dn
            .managerDn("cn=Admin,ou=SERVICEACCT,dc=in,DC=com")
            .managerPassword("1234");

What may be the issue.

Thanks, Jayendra

sjayendra
  • 91
  • 3
  • 9
  • Please Check this it may help you : https://stackoverflow.com/questions/10607865/ldap-error-code-32 – RahulKumarShaw Oct 30 '21 at 03:45
  • The main reason for NameNotFoundException is that the object which you're searching doesn't exist or the container in which you are searching is not correct – RahulKumarShaw Oct 30 '21 at 03:47
  • Thanks RahulKumar for your quick reply. Same configuration we have used in Motomo for AD integration and it is working fine there. Not able to understand why same configuration not working in Spring. – sjayendra Oct 30 '21 at 13:25
  • 1
    Replace .userDnPatterns("cn=users,dc=in,dc=com") with .userDnPatterns("ou=users,dc=in,dc=com") Please try with this. – RahulKumarShaw Oct 31 '21 at 02:47
  • 1
    Hello @sjayendra, did the posted solution resolve your issue ? or is there any update for the same? – RahulKumarShaw Nov 01 '21 at 03:13
  • Hi @RahulKumarShaw-MT, Sorry for the delayed reply. I have changed the userDnPattens parameter as per your suggestion but error remains same. Anything else need to try ? – sjayendra Nov 03 '21 at 14:32
  • Thanks @RahulKumarShaw-MT now its working, added following parameter: .userSearchBase() – sjayendra Nov 23 '21 at 11:50
  • Glad to know you fix your solution. Posting this is an answer to help other communtiy member as well – RahulKumarShaw Nov 23 '21 at 11:55
  • @sjyayendra Can you please let me know what parameter did you pass in .userSearchBase() – RahulKumarShaw Nov 23 '21 at 12:04
  • 1
    Sorry for the delayed reply. Please find below details .userSearchBase("DC=in,DC=com") – sjayendra Dec 30 '21 at 11:44

0 Answers0