javaspringldapspring-ldapspring-security-ldap

LDAP: error code 49 - 80090308: LdapErr: DSID-0C09044E, comment: AcceptSecurityContext error, data 52e, v2580 (first time using ldap)


I am having problem with ldap on spring, I know what that error means but idk what i am doing wrong in the config of the connection

this is my application.properties :

spring.ldap.urls=ldap://***
spring.ldap.base=OU=Account,DC=company,DC=lan
spring.ldap.username=CN=Intranet company
spring.ldap.password=pswd

The password are good and username too but maybe my base is false? can anyone help me plz?

and here is what i try to do

@Autowired
private LdapTemplate ldapTemplate;
System.out.println( ldapTemplate.search(
        "OU=Account,DC=company,DC=lan",
        "cn=" + account.username ,
                (AttributesMapper<String>) attrs -> (String) attrs.get("sAMAccountName").get()));

I just try to connect to the active directory and discover how it works


Solution

  • The error message makes it clear that you're using Active Directory. So I'm pretty sure this is the problem:

    spring.ldap.username=CN=Intranet company
    

    I don't think Active Directory likes that format for the username. It either has to be: