Closed kamilk91 closed 1 year ago
I assume that you have stripped away some sensitive data from your sample code, because there is nothing in line 26. Therefore, it is hard to tell what is actually happening. My guess is the following: When the authentication service logs in, it performs an LDAP bind with the credentials provided and if that succeeds, it retrieves the user's LDAP entry to populate the user object. The latter is dependent on the search base you have configured in the LDAP options, whereas the bind is independent from this (you pass the full CN, or the UPN in case of AD).
Is the user that is being authenticated in the OU you configured as search base (or in a sub-OU with the search scope being configured appropriately)?
One other point: You wrote that you are using PHPLDAPAdmin, wherefore I assume that your server is not running Active Directory Domain Services, but OpenLDAP or something else. You may need to provide a custom mapping (in code or via your appsettings.json) with an appropriate user filter matching your schema. See https://github.com/UniStuttgart-VISUS/Visus.LdapAuthentication/blob/92d44542b0cb7785dc6167033de70981263f8bb8/Visus.LdapAuthentication/LdapOptions.cs#L61-L68 I think the user filter should be "(uid={0})" for OpenLDAP, but I have no hands-on experience with this kind of server.
Version 1.10.0 adds a new schema "RFC 2307" which should work against OpenLDAP servers.
My implementation: .Net 6
My LDAP is managed by PHPLDAPAdmin.
i login as the same user im doing it in app.