Base solution for your next web application
Open Closed

LDAP not working! #10334


User avatar
0
peteras created

My environment .net core 5.0.6 Product version v10.3.0 (angular)

I can not establish sync with AD. I did enabled LDAP using documentation. Also Module is enabled. Here is result of /TenantSettings/GetAllSettings:

    "ldap": {
      "isModuleEnabled": true,
      "isEnabled": true,
      "domain": "XXXX",
      "userName": "YYYY",
      "password": "ZZZZZ"
    },

there is no error recorded in log.

IIS is set to accept both Anonymus and win auth. Do I need to change aslo launchSettings.json? Is there any check list what needs to be done to get LDAP sync work?

I was able to detect problem. LDAP is working it is getting user information but it looks like info is not stored into user table and this is causing issues here:

var loginResult = await _logInManager.LoginAsync(usernameOrEmailAddress, password, tenancyName);
Mvc.ExceptionHandling.AbpExceptionFilter - Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Abp.Authorization.Users.AbpUser`1.SetNormalizedNames()
   at Abp.Authorization.AbpLogInManager`3.TryLoginFromExternalAuthenticationSourcesAsync(String userNameOrEmailAddress, String plainPassword, TTenant tenant)
   at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
   at Abp.Authorization.AbpLogInManager`3.LoginAsyncInternal(String userNameOrEmailAddress, String plainPassword, String tenancyName, Boolean shouldLockout)
   at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
   at Abp.Authorization.AbpLogInManager`3.LoginAsync(String userNameOrEmailAddress, String plainPassword, String tenancyName, Boolean shouldLockout)
   at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
   at MDemo.Web.Controllers.TokenAuthController.GetLoginResultAsync(String usernameOrEmailAddress, String password, String tenancyName) in Web.Core\Controllers\TokenAuthController.cs:line 753
   at MDemo.Web.Controllers.TokenAuthController.Authenticate(AuthenticateModel model) in Web.Core\Controllers\TokenAuthController.cs:line 138
   at lambda_method1709(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeInnerFilterAsync&gt;g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

2 Answer(s)
  • User Avatar
    0
    musa.demir created

    Can you please check if created user's username or email address are null

  • User Avatar
    0
    peteras created

    Hi - yes problem was in email information. After updating account in AD with email info - user was created and all is ok