Base solution for your next web application
Open Closed

LDAP Authentication fails with NullReferenceException #7380


User avatar
0
enio created

I have enabled LDAP authentication in code and afterwards on the settings page.

When I try to login with a non existing AD-User or take a wrong password I get the correct not authorized error message. However if I use an existing AD-username and correct password I get the following exception:

ERROR 2019-07-24 17:24:18,800 [82 ] 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.AbpUser1.SetNormalizedNames() at Abp.Authorization.AbpLogInManager3.TryLoginFromExternalAuthenticationSources(String userNameOrEmailAddress, String plainPassword, TTenant tenant) at Abp.Authorization.AbpLogInManager3.LoginAsyncInternal(String userNameOrEmailAddress, String plainPassword, String tenancyName, Boolean shouldLockout) at Abp.Authorization.AbpLogInManager3.LoginAsync(String userNameOrEmailAddress, String plainPassword, String tenancyName, Boolean shouldLockout) at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult[T](Task1 actualReturnValue, Func1 postAction, Action`1 finalAction) at web_manager.Web.Controllers.TokenAuthController.GetLoginResultAsync(String usernameOrEmailAddress, String password, String tenancyName) in /home/vsts/work/1/s/src/web_manager.Web.Core/Controllers/TokenAuthController.cs:line 590 at web_manager.Web.Controllers.TokenAuthController.Authenticate(AuthenticateModel model) in /home/vsts/work/1/s/src/web_manager.Web.Core/Controllers/TokenAuthController.cs:line 112 at lambda_method(Closure , Object ) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()

Can you please point me the direction where I should search for a solution? As I get the exception message above only with correct login credentials I guess that ABP successfully communicated with the AD.

kind regards, marco


1 Answer(s)
  • User Avatar
    0
    enio created

    I found the answer elsewhere in the forum - our users in the ActiveDirectory don't have an email adress set:

    https://support.aspnetzero.com/QA/Questions/6180#answer-2ce4d101-ea8a-5387-f188-39eade0e077c

    AND

    https://support.aspnetzero.com/QA/Questions/3121#answer-2c69c3d0-fab5-479a-8189-01157bfbaa5d