go-ldap / ldap

Basic LDAP v3 functionality for the GO programming language.
Other
2.23k stars 352 forks source link

can I bind with just username not dn? #443

Closed tooptoop4 closed 1 year ago

tooptoop4 commented 1 year ago

I don't want to have a service account binding but want to use incoming user creds to bind. but they will only supply username/email not DN. note:server does not allow anon bind

I read "Active Directory will let you also bind using userPrincipalName instead of DN, so it might be helpful to attempt to bind as username@domain.com instead of username. Either users can be instructed to log in this way or the application can add @domain.com part upon binding attempt if feasible."

cpuschma commented 1 year ago

You can use another RDN if the directory server supports this. Active Directory for example allows you to use the sAMAccountName as bind name.

You can't use the plain CN for binding. In that case, you need to run a LDAP search request first to resolve the username to a distinguishedName

tooptoop4 commented 1 year ago

user@domain worked well for active directory