I am trying to authenticate a valid user against a Active Directory. I say the user is valid because I can authenticate using this user against AD in different application.
I have the following so far:
Code:ActiveDirectoryLdapAuthenticationProvider adlap = new ActiveDirectoryLdapAuthenticationProvider("domain.com", "ldap://ldap.domain.com/"); adlap.setConvertSubErrorCodesToExceptions(true); UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("username@domain.com", "password"); adlap.authenticate(auth);
I get the following error:
From my understanding, it is saying that the password is incorrect but I am sure that the password is correct.Code:Aug 08, 2012 2:52:05 PM org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider handleBindException INFO: Active Directory authentication failed: Supplied password was invalid org.springframework.security.authentication.BadCredentialsException: Bad credentials at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.badCredentials(ActiveDirectoryLdapAuthenticationProvider.java:244) at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.bindAsUser(ActiveDirectoryLdapAuthenticationProvider.java:168) at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.doAuthentication(ActiveDirectoryLdapAuthenticationProvider.java:111) at org.springframework.security.ldap.authentication.AbstractLdapAuthenticationProvider.authenticate(AbstractLdapAuthenticationProvider.java:61) at Main.main(Main.java:12)
If I have the following:
I get:Code:new UsernamePasswordAuthenticationToken("username", "password");
Any links or any information would be greatly appreciated.Code:Aug 08, 2012 3:03:57 PM org.springframework.security.ldap.SpringSecurityLdapTemplate searchForSingleEntryInternal INFO: Ignoring PartialResultException org.springframework.dao.IncorrectResultSizeDataAccessException: Incorrect result size: expected 1, actual 0 at org.springframework.security.ldap.SpringSecurityLdapTemplate.searchForSingleEntryInternal(SpringSecurityLdapTemplate.java:239) at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.searchForUser(ActiveDirectoryLdapAuthenticationProvider.java:258) at org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider.doAuthentication(ActiveDirectoryLdapAuthenticationProvider.java:114) at org.springframework.security.ldap.authentication.AbstractLdapAuthenticationProvider.authenticate(AbstractLdapAuthenticationProvider.java:61) at Main.main(Main.java:12)


Reply With Quote
