Hi,
We're setting up LDAP Authentication using the guides.
So far, LDAP Authentication works flawlessly. However it doesn't seem to save in the database.
Although the CreateAsync methods seem to work, ie
return await this.Store.CreateAsync(user, this.CancellationToken);
it appears that in AbpLoginManager.cs, this line,
wait UnitOfWorkManager.Current.SaveChangesAsync();
does not work.
Because when in the function LoginAsyncInternal, when the following line is called:
return await CreateLoginResultAsync(user, tenant);
the
await UserManager.UpdateAsync(user);
line in the function is unable to run because it cannot find the user.
Could you advise further?
Regards, Simon Dean
8 Answer(s)
-
0
@SDdev are there any error message in the Log file (App_Data/Logs/Logs.txt) ?
-
0
Hi,
I have located the following exception, which doesn't really tell me anything as far as I can. Interestingly, every time it tries to create a user, the user id does increase. I started on 15, it's now on 21. However nothing seems to get saved in the database which is rather curious.
The logs are:
ERROR 2018-09-13 16:00:59,135 [5 ] Mvc.ExceptionHandling.AbpExceptionFilter - There is no such an entity. Entity type: ACUTEC.TimeAndAttendance.Authorization.Users.User, id: 21 Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: ACUTEC.TimeAndAttendance.Authorization.Users.User, id: 21 at Abp.Domain.Repositories.AbpRepositoryBase`2.<GetAsync>d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Abp.Authorization.Users.AbpUserStore`2.<GetUserNameFromDatabaseAsync>d__88.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Abp.Authorization.Users.AbpUserManager`2.<UpdateAsync>d__47.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Abp.Authorization.AbpLogInManager`3.<CreateLoginResultAsync>d__38.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Abp.Authorization.AbpLogInManager`3.<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.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Abp.Authorization.AbpLogInManager`3.<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.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at ACUTEC.TimeAndAttendance.Web.Controllers.TokenAuthController.<GetLoginResultAsync>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.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at ACUTEC.TimeAndAttendance.Web.Controllers.TokenAuthController.<Authenticate>d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at lambda_method(Closure , Object ) at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 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>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext() INFO 2018-09-13 16:00:59,657 [5 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2018-09-13 16:00:59,769 [5 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action ACUTEC.TimeAndAttendance.Web.Controllers.TokenAuthController.Authenticate (ACUTEC.TimeAndAttendance.Web.Core) in 119691.8196ms INFO 2018-09-13 16:00:59,786 [5 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 121212.3609ms 404 application/json; charset=utf-8
-
0
If I try to manually run the commands in the debug stack on line 323 and 334 of AbpLoginManager (ie await UserManager.CreateAsync(user) and await UnitOfWorkManager.Current.SaveChangesAsync() I get the following results:
CreateAsync: The function evaluation requires all threads to run SaveChangesAsync: Cannot apply unary operator to non-primitive value
Im not seeing anything obvious however.
Regards, Simon Dean
-
0
@SDdev
- Are you using the latest version of ABP ?
- Are you trying with the host or a tenant ?
-
0
@sddev any news ?
-
0
Closing because of inactivity. Please reopen the topic if you are not able to solve the problem.
-
0
Sorry for the delay in updating.
We're using a version of ASP.NET Zero that was originally downloaded in April.
Through the login page, we're selecting a Tenant, and then going to Login. The TryLoginFromExternalAuthenticationSources as far as I know should be trying to log in to our LDAP Server and indeed this works fine. However then when trying to create the user, it fails as above.
Regards, Simon Dean
-
0
Can confirm this now works as expected in 5.6.2