Base solution for your next web application
Open Closed

LDAP Integration With Tenant #12141


User avatar
0
[email protected] created

Hi @oguzhanagir ,

We are using Asp.net Zero V 13.3.0 with.NET Core and Angular.

We enabled the LDP setting and tried to log in as a Tenant User. We are receiving the following error.

System.DirectoryServices.AccountManagement.PrincipalServerDownException: The server could not be contacted. ---> System.DirectoryServices.Protocols.LdapException: The LDAP server is unavailable. at System.DirectoryServices.Protocols.LdapConnection.Connect() at System.DirectoryServices.Protocols.LdapConnection.SendRequestHelper(DirectoryRequest request, Int32& messageID) at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout) at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request) at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties) --- End of inner exception stack trace --- at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties) at System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval() at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, ContextOptions options, String userName, String password) at Abp.Zero.Ldap.Authentication.LdapAuthenticationSource2.CreatePrincipalContext(TTenant tenant) at Abp.Zero.Ldap.Authentication.LdapAuthenticationSource2.TryAuthenticateAsync(String userNameOrEmailAddress, String plainPassword, TTenant tenant) at Abp.Authorization.AbpLogInManager3.TryLoginFromExternalAuthenticationSourcesAsync(String userNameOrEmailAddress, String plainPassword, TTenant tenant) at Abp.Authorization.AbpLogInManager3.LoginAsyncInternal(String userNameOrEmailAddress, String plainPassword, String tenancyName, Boolean shouldLockout) at Abp.Authorization.AbpLogInManager`3.<>c__DisplayClass37_0.<

How to be doing both ways.


5 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi cyber50.ae

    Have you implemented the conditions specified in this document (https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Features-Mvc-Core-Tenant-Active-Directory)?

  • User Avatar
    0
    [email protected] created

    Have you implemented the conditions specified in this document

    Yes, we have followed this document. Issue is, enabling the LDAP is not allowing us to login using the tenant credentials. It is limiting the login to LDAP itself. we want Authenticate both ways. so how to achieve this?

  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi

    You can enable tenant users to login, in addition to LDAP users, by overriding the relevant methods of the LdapAuthenticationSource class as an inheritance in the AppLdapAuthenticationSource class.

    Related method

  • User Avatar
    0
    [email protected] created

    Hi

    You can enable tenant users to login, in addition to LDAP users, by overriding the relevant methods of the LdapAuthenticationSource class as an inheritance in the AppLdapAuthenticationSource class.

    Related method

    we follow this method abstract class

    This is my code. I am trying to login as Default Tenant and LDAP Is enable then I got same error.

  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi cyber50.ae

    By default, there is no such setting, but you can enable tenant users to log in together with the LDAP user by changing the content of the overridden method. You will need to make manual changes here.

    You can edit the content of the ValidateCredentials method to enable tenant users to log in when LDAP is active.