Base solution for your next web application
Open Closed

LDAP Login error - Empty email address #6180


User avatar
0
peabaw created

Hi

I just activated LDAP through the GUI User Management and tried to log in with an AD user. It failed with internal error. The AD user does not have an email address and it seems this is a requirement currently in ABP/Zero, or am I wrong? How could I work around this to allow non-email AD users to login?

Service: TokenAuthController Action: Authenticate

Error state

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 TokenAuthController.GetLoginResultAsync(String usernameOrEmailAddress, String password, String tenancyName) in .Web.Core\Controllers\TokenAuthController.cs:line 521 at Peab.GHR.Web.Controllers.TokenAuthController.Authenticate(AuthenticateModel model) in .Web.Core\Controllers\TokenAuthController.cs:line 107 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()

Best regards // Andreas


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

    Hi @peabaw

    You can override TryLoginFromExternalAuthenticationSources method of LoginManager class and set a value for email address.

    ABP's implementation requires an email address for the user.

  • User Avatar
    0
    peabaw created

    Thank you. I'll try that!