Reputation: 62185
I'm trying to connect to an Active Directory using the standard Java (javax.naming.*) libraries.
This seems to work exactly like connecting to any other LDAP except for one difference: The SECURITY_PRINCIPAL
needs to be supplied in the form
sAMAccountName@domainComponent(s)
e.g.
env.put(Context.SECURITY_PRINCIPAL, "[email protected]"
Trying to use use a valid DN which points to the exact same user like
env.put(Context.SECURITY_PRINCIPAL, "cn=foo,cn=Users,dc=bar,dc=baz,dc=org
result in a AuthenticationException
. Is this something specific to Active Directory? For other LDAP DS, the last approach always worked.
Upvotes: 1
Views: 568
Reputation: 18405
This is not AD authentication what you are performing. You are performing a mere LDAP bind. AD auth is Kerberos.
The LDAP compement of the AD expects principal either as UPN, samaccountname or NT4-style logins. No DNs accepted.
Upvotes: 1