Base solution for your next web application
Open Closed

Active directory integration #5185


User avatar
0
vrpatlola created

Hi, I want to use AD authentication for Authenticating asp.net zero application.

Question:

  • How to signup active directory user in asp.net zero application?
  • Do I need to create user in asp.net zero application for each Active directory user? if yes how to map Active directory user and asp.net zero application user? OR asp.net zero will automatically create user in asp.net zero application?
  • Want to use asp.net zero authorization and AD authentication.

Please guide.

Thank you! Prashant


13 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @vrpatlola,

    When a user logins with LDAP, a user will be created on AspNet Zero automatically. After user creation on AspNet Zero, if you set a password for this user using user edit modal, user can login both with AD and regular AspNet Zero login.

    By default, you can use LDAP is single tenant mode but it is possible to use it multi-tenant mode if you would like to by changing a few lines of code.

    If you don't know how to enable LDAP, please go to <a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide">https://aspnetzero.com/Documents/Development-Guide</a>, select your version and in the opening page go to "Enabling LDAP (Active Directory) Authentication".

  • User Avatar
    0
    vrpatlola created

    <cite>ismcagdas: </cite> Hi @vrpatlola,

    When a user logins with LDAP, a user will be created on AspNet Zero automatically. After user creation on AspNet Zero, if you set a password for this user using user edit modal, user can login both with AD and regular AspNet Zero login.

    By default, you can use LDAP is single tenant mode but it is possible to use it multi-tenant mode if you would like to by changing a few lines of code.

    If you don't know how to enable LDAP, please go to <a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide">https://aspnetzero.com/Documents/Development-Guide</a>, select your version and in the opening page go to "Enabling LDAP (Active Directory) Authentication".

    I am using asp.net zero (Angular + Asp.Net Core ) and Target framework is 4.6.1 I have enabled LDAP , but when I try to login with AD account is showing me "An internal error occurred during your request!" Please guide !

    Thank you!

  • User Avatar
    0
    aaron created
    Support Team

    Check your Logs.txt.

  • User Avatar
    0
    vrpatlola created

    In logs it showing following message

    Hosting environment: Production Content root path: C:\inetpub\wwwroot\ad_fbmwebapi Now listening on: <a class="postlink" href="http://localhost:20156">http://localhost:20156</a> Application started. Press Ctrl+C to shut down.

    In Chrome console showing : .../api/TokenAuth/Authenticate 500 (Internal Server Error)

    Thank you! Prashant

  • User Avatar
    0
    ismcagdas created
    Support Team

    @vrpatlola corret log file shot be App_Data/Logs/Logs.txt or App_Data/Logs.txt. Could you check that ?

  • User Avatar
    0
    gowthamv created

    @vrpatlola did you resolve the issue? I am also getting the same error. Please share the steps if you are able to resolve it.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @gowthamv,

    What is the error message you are seeing ?

  • User Avatar
    0
    gowthamv created

    Hi,

    The server is running with the same domain, Please see the below Error State from Operation logs

    System.NullReferenceException: Object reference not set to an instance of an object. at Abp.Authorization.Users.AbpUser1.SetNormalizedNames() at Abp.Authorization.AbpLogInManager3.<TryLoginFromExternalAuthenticationSources>d__41.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsyncInternal>d__37.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsync>d__36.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at AspenTech.aspenPortalFramework.Web.Controllers.TokenAuthController.<GetLoginResultAsync>d__32.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult...

  • User Avatar
    0
    aaron created
    Support Team

    Are you using a custom authentication source? ABP's LdapAuthenticationSource.CreateUserAsync returns a non-null User.

  • User Avatar
    0
    gowthamv created

    Not using any custom authentication source.

  • User Avatar
    0
    gowthamv created

    Hi @ismcagdas,

    I am not using any custom auth source, see below error log

    Error State from Operation logs

    System.NullReferenceException: Object reference not set to an instance of an object. at Abp.Authorization.Users.AbpUser1.SetNormalizedNames() at Abp.Authorization.AbpLogInManager3.<TryLoginFromExternalAuthenticationSources>d__41.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsyncInternal>d__37.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsync>d__36.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at AspenTech.aspenPortalFramework.Web.Controllers.TokenAuthController.<GetLoginResultAsync>d__32.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult...

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi @gowthamv

    Can i check what is the value you used for the setting Abp.Zero.Ldap.ContextType?

  • User Avatar
    0
    ryancyq created
    Support Team

    Possible related to <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3620">https://github.com/aspnetboilerplate/as ... ssues/3620</a>