Base solution for your next web application
Open Closed

LDAP Authentication #1613


User avatar
0
jamsecgmbh created

Hi,

is it possible to define user accounts with all kind of info (Full name, E-Mailaddress, Group-Assignments ...) before the users log in for the first time using LDAP Authentication with their AD usernamen and password? Is the only important thing to create the account with the exact Windows AD username? If so do I need to include the domainname (e.g. domain\username)?

Can I mix these LDAP accounts with accounts only existing in the ASP.NET Zero application database?

Is it possible to create the users in batch by inserting them directly into the ASP.NET Zero database and then assign the groups in the backend application?

Thank you very much in advance! Great product, great support!


2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Let me explain the LDAP auth logic first:

    This is the class which makes authentication for LDAP: <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/dev/src/Abp.Zero.Ldap/Ldap/Authentication/LdapAuthenticationSource.cs">https://github.com/aspnetboilerplate/mo ... nSource.cs</a>

    1. TryAuthenticateAsync method (<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/dev/src/Abp.Zero.Ldap/Ldap/Authentication/LdapAuthenticationSource.cs#L42">https://github.com/aspnetboilerplate/mo ... rce.cs#L42</a>) checks a user in active directory.

    2. CreateUserAsync method (<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/dev/src/Abp.Zero.Ldap/Ldap/Authentication/LdapAuthenticationSource.cs#L56">https://github.com/aspnetboilerplate/mo ... rce.cs#L56</a>) creates the user if this is the first time he logins

    3. UpdateUserAsync method (<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/dev/src/Abp.Zero.Ldap/Ldap/Authentication/LdapAuthenticationSource.cs#L80">https://github.com/aspnetboilerplate/mo ... rce.cs#L80</a>) updates user information in next logins. Thus, we can synchonize information here.

    All of these are defined in Abp.Zero package, but we can override any method if we want to execute some custom logic. Where?

    AspNet Zero includes AppLdapAuthenticationSource class (<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Core/Authorization/Ldap/AppLdapAuthenticationSource.cs">https://github.com/aspnetzero/aspnet-ze ... nSource.cs</a>). Here, you can override any method you want.

    In AspNet Zero, we can mix LDAP with non-LDAP accounts as default.

    You can code it yourself to batch insert LDAP users, there is no such a built-in functionality.

  • User Avatar
    0
    jamsecgmbh created

    Great and easy to understand explanation! Thank you very much!