What is your product version? 10.3 What is your product type (Angular or MVC)? Angular What is product framework type (.net framework or .net core)? .Net Core Which theme are you using? Default What is ABP Framework version? 6.3
Hi team, We’re getting the below error when we’re visiting the pages and it occurs intermittently. We neither customize the authentication nor UnitOfWork or wrote any wrapper.
We are only using DI to get repository or services.
Error with Stack Trace:
ERROR 2022-01-14 12:49:34,865 [53 ] Mvc.Authorization.AbpAuthorizationFilter - System.ArgumentNullException: Value cannot be null. (Parameter 'unitOfWork')
at Abp.EntityFrameworkCore.Uow.UnitOfWorkExtensions.GetDbContextAsync[TDbContext](IActiveUnitOfWork unitOfWork, Nullable1 multiTenancySide, String name) at Abp.EntityFrameworkCore.Uow.UnitOfWorkDbContextProvider
1.GetDbContextAsync(Nullable1 multiTenancySide) at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase
3.GetContextAsync()
at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase3.GetDbQueryTableAsync() at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase
3.GetQueryableAsync()
at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase3.GetAllIncludingAsync(Expression
1[] propertySelectors)
at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase3.GetAllAsync() at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase
3.FirstOrDefaultAsync(TPrimaryKey id)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Authorization.Users.AbpUserManager2.<>c__DisplayClass88_0.<<GetUserPermissionCacheItemAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Abp.Runtime.Caching.TypedCacheWrapper
2.<>c__DisplayClass18_0.<<GetAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Abp.Runtime.Caching.AbpCacheBase2.GetAsync(TKey key, Func
2 factory)
at Abp.Runtime.Caching.TypedCacheWrapper2.GetAsync(TKey key, Func
2 factory)
at Abp.Authorization.Users.AbpUserManager2.GetUserPermissionCacheItemAsync(Int64 userId) at Abp.Authorization.Users.AbpUserManager
2.IsGrantedAsync(Int64 userId, Permission permission)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Authorization.Users.AbpUserManager2.IsGrantedAsync(Int64 userId, String permissionName) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Abp.Authorization.PermissionChecker
2.IsGrantedAsync(Int64 userId, String permissionName)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Authorization.PermissionChecker2.IsGrantedAsync(String permissionName) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Abp.Authorization.PermissionCheckerExtensions.IsGrantedAsync(IPermissionChecker permissionChecker, Boolean requiresAll, String[] permissionNames) at Abp.Authorization.PermissionCheckerExtensions.AuthorizeAsync(IPermissionChecker permissionChecker, Boolean requireAll, String[] permissionNames) at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(IEnumerable
1 authorizeAttributes)
at Abp.Authorization.AuthorizationHelper.CheckPermissionsAsync(MethodInfo methodInfo, Type type)
at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(MethodInfo methodInfo, Type type)
at Abp.AspNetCore.Mvc.Authorization.AbpAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context)
System.ArgumentNullException: Value cannot be null. (Parameter 'unitOfWork')
at Abp.EntityFrameworkCore.Uow.UnitOfWorkExtensions.GetDbContextAsync[TDbContext](IActiveUnitOfWork unitOfWork, Nullable1 multiTenancySide, String name) at Abp.EntityFrameworkCore.Uow.UnitOfWorkDbContextProvider
1.GetDbContextAsync(Nullable1 multiTenancySide) at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase
3.GetContextAsync()
at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase3.GetDbQueryTableAsync() at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase
3.GetQueryableAsync()
at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase3.GetAllIncludingAsync(Expression
1[] propertySelectors)
at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase3.GetAllAsync() at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase
3.FirstOrDefaultAsync(TPrimaryKey id)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Authorization.Users.AbpUserManager2.<>c__DisplayClass88_0.<<GetUserPermissionCacheItemAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Abp.Runtime.Caching.TypedCacheWrapper
2.<>c__DisplayClass18_0.<<GetAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Abp.Runtime.Caching.AbpCacheBase2.GetAsync(TKey key, Func
2 factory)
at Abp.Runtime.Caching.TypedCacheWrapper2.GetAsync(TKey key, Func
2 factory)
at Abp.Authorization.Users.AbpUserManager2.GetUserPermissionCacheItemAsync(Int64 userId) at Abp.Authorization.Users.AbpUserManager
2.IsGrantedAsync(Int64 userId, Permission permission)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Authorization.Users.AbpUserManager2.IsGrantedAsync(Int64 userId, String permissionName) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Abp.Authorization.PermissionChecker
2.IsGrantedAsync(Int64 userId, String permissionName)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Authorization.PermissionChecker2.IsGrantedAsync(String permissionName) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Abp.Authorization.PermissionCheckerExtensions.IsGrantedAsync(IPermissionChecker permissionChecker, Boolean requiresAll, String[] permissionNames) at Abp.Authorization.PermissionCheckerExtensions.AuthorizeAsync(IPermissionChecker permissionChecker, Boolean requireAll, String[] permissionNames) at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(IEnumerable
1 authorizeAttributes)
at Abp.Authorization.AuthorizationHelper.CheckPermissionsAsync(MethodInfo methodInfo, Type type)
at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(MethodInfo methodInfo, Type type)
at Abp.AspNetCore.Mvc.Authorization.AbpAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context)
Information:
What is your product version? 10.3 What is your product type (Angular or MVC)? Angular What is product framework type (.net framework or .net core)? ASP.Net Code Which theme are you using? Default
Question - How to integrate Siteminder authentication with ASP.NET ZERO for authentication whereas authorization should continue to be used from ASP.NET ZERO?
Currently, our application will be protected by siteminder for user authentication and all login and password related pages will be served from siteminder itself. Once user gets authenticated in the siteminder it will be redirected to our application. We will get the logged in user id from the siteminder in the header. With this context, how do we bypass the user authentication process implemented in ASP.NET Zero.
Login and related pages should not be served from ASP.NET Zero. If we get the user id from siteminder header should assume that user is authenticated.
There shouldn't be any user authentication takes place which as there will be no password stored in ASP.NET ZERO database. We will not have a password to pass in following method as we don’t want to authenticate. public async Task<AuthenticateResultModel> Authenticate([FromBody] AuthenticateModel model) { var loginResult = await GetLoginResultAsync( model.UserNameOrEmailAddress, model.Password, GetTenancyNameOrNull() ); }
Once we get siteminder header with user id, rest of the process for authorizations and permissions should continue to work as it is with ASP.NET ZERO.
ABP Login manager code is not available in code download.
Information:
Question - There are two query regarding user entity as mention below:-