I tested this module https://docs.abp.io/en/commercial/latest/modules/payment
When I add some extension, I want to test this, but when I run this demo appear some error
[11:57:13 INF] Request starting HTTP/1.1 POST http://localhost:57891/Payment/WeChat/PrePayment?paymentRequestId=41648e16-fee0-7d74-de67-39fd2a4a6f19 application/x-www-form-urlencoded 521
[11:57:13 INF] Identity.Application was not authenticated. Failure message: Unprotect ticket failed
[11:57:13 INF] AUDIT LOG: [404: POST ] /Payment/WeChat/PrePayment
- UserName - UserId : -
- ClientIpAddress : ::1
- ExecutionDuration : 0
[11:57:13 INF] Request finished HTTP/1.1 POST http://localhost:57891/Payment/WeChat/PrePayment?paymentRequestId=41648e16-fee0-7d74-de67-39fd2a4a6f19 application/x-www-form-urlencoded 521 - 404 0 - 0.8390ms
and I'm consider whether is not logged in, but there are some problems logging in
[12:02:56 INF] AUDIT LOG: [200: GET ] /Account/Login
- UserName - UserId : -
- ClientIpAddress : ::1
- ExecutionDuration : 4
- Actions:
- Volo.Abp.Account.Web.Pages.Account.LoginModel.OnGetAsync (0 ms.)
{}
- Exceptions:
- Undefined setting: Abp.Account.EnableLocalLogin
Volo.Abp.AbpException: Undefined setting: Abp.Account.EnableLocalLogin
at Volo.Abp.Settings.SettingDefinitionManager.Get(String name)
at Volo.Abp.Settings.SettingProvider.GetOrNullAsync(String name)
at Volo.Abp.Settings.SettingProviderExtensions.IsTrueAsync(ISettingProvider settingProvider, String name)
at Volo.Abp.Account.Web.Pages.Account.LoginModel.OnGetAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isComplete
d)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
2021-03-23 06:38:22.426 +00:00 [INF] Starting Yiki.CoFarm.IdentityServer.
2021-03-23 06:38:24.278 +00:00 [WRN] Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
2021-03-23 06:38:24.280 +00:00 [INF] User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
2021-03-23 06:38:24.315 +00:00 [INF] Creating key {bdb6cead-ab9f-47e5-972e-3062c2af2453} with creation date 2021-03-23 06:38:24Z, activation date 2021-03-23 06:38:24Z, and expiration date 2021-06-21 06:38:24Z.
2021-03-23 06:38:24.321 +00:00 [WRN] No XML encryptor configured. Key {bdb6cead-ab9f-47e5-972e-3062c2af2453} may be persisted to storage in unencrypted form.
2021-03-23 06:38:24.324 +00:00 [INF] Writing data to file '/root/.aspnet/DataProtection-Keys/key-bdb6cead-ab9f-47e5-972e-3062c2af2453.xml'.
2021-03-23 06:38:24.368 +00:00 [INF] Loaded ABP modules:
2021-03-23 06:38:24.368 +00:00 [INF] - Volo.Abp.Castle.AbpCastleCoreModule
2021-03-23 06:38:24.368 +00:00 [INF] - Volo.Abp.Autofac.AbpAutofacModule
2021-03-23 06:38:24.368 +00:00 [INF] - Volo.Abp.Threading.AbpThreadingModule
......
2021-03-23 06:38:24.369 +00:00 [INF] - Yiki.CoFarm.CoFarmIdentityServerModule
2021-03-23 06:38:24.654 +00:00 [FTL] Application startup exception
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Yiki.CoFarm.CoFarmIdentityServerModule, Yiki.CoFarm.IdentityServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating λ:Volo.Abp.AspNetCore.VirtualFileSystem.IWebContentFileProvider -> Volo.Abp.AspNetCore.VirtualFileSystem.WebContentFileProvider -> λ:Volo.Abp.VirtualFileSystem.IVirtualFileProvider -> Volo.Abp.VirtualFileSystem.VirtualFileProvider.. See the inner exception for details.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating λ:Volo.Abp.AspNetCore.VirtualFileSystem.IWebContentFileProvider -> Volo.Abp.AspNetCore.VirtualFileSystem.WebContentFileProvider -> λ:Volo.Abp.VirtualFileSystem.IVirtualFileProvider -> Volo.Abp.VirtualFileSystem.VirtualFileProvider.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemOptions], Volo.Abp.VirtualFileSystem.IDynamicFileProvider)' on type 'VirtualFileProvider'.
---> System.IO.DirectoryNotFoundException: /Yiki.CoFarm.Domain.Shared/
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
at Volo.Abp.VirtualFileSystem.VirtualFileSetListExtensions.ReplaceEmbeddedByPhysical[T](VirtualFileSetList fileSets, String physicalPath)
at Yiki.CoFarm.CoFarmIdentityServerModule.<>c__DisplayClass1_0.<ConfigureServices>b__3(AbpVirtualFileSystemOptions options) in /src/aspnet-core/src/Yiki.CoFarm.IdentityServer/CoFarmIdentityServerModule.cs:line 90
at Microsoft.Extensions.Options.ConfigureNamedOptions`1.Configure(String name, TOptions options)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.OptionsManager`1.<>c__DisplayClass5_0.<Get>b__0()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
at Volo.Abp.VirtualFileSystem.VirtualFileProvider..ctor(IOptions`1 options, IDynamicFileProvider dynamicFileProvider)
at lambda_method962(Closure , Object[] )
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
......
version: '3.4'
services:
basketdata:
image: redis
# volumes:
# - /Users/Shared/redis-data:/var/lib/redis/data
sqldata:
image: postgres
environment:
- POSTGRES_DB=CoFarm
- POSTGRES_USER=aspnetcore
- POSTGRES_PASSWORD=<pwd>
# volumes:
# - /Users/Shared/pg-data:/var/lib/pgsql/data
yikicofarmidentityserver:
image: yikicofarmidentityserver
environment:
- ConnectionString=User ID=aspnetcore;Password=<pwd>;Host=sqldata;Port=5432;Database=CoFarm;Pooling=true;Minimum Pool Size=0;Maximum Pool Size=100;Connection Lifetime=0;
build:
context: .
dockerfile: aspnet-core/src/Yiki.CoFarm.IdentityServer/Dockerfile
ports:
- 80
depends_on:
- basketdata
- sqldata
# volumes:
# - ~/Users/yikicoform:/ids:rw
yikicofarmhttpapihost:
image: yikicofarmhttpapihost
environment:
- ConnectionString=User ID=aspnetcore;Password=<pwd>;Host=sqldata;Port=5432;Database=CoFarm;Pooling=true;Minimum Pool Size=0;Maximum Pool Size=100;Connection Lifetime=0;
build:
context: .
dockerfile: aspnet-core/src/Yiki.CoFarm.HttpApi.Host/Dockerfile
ports:
- 81
depends_on:
- basketdata
- sqldata
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.Security.Claims;
using Volo.Abp.Uow;
using IdentityRole = Volo.Abp.Identity.IdentityRole;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
namespace Hang.Blog.Web.MyIdentity
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AbpUserClaimsPrincipalFactory))]
public class MyUserClaimsPrincipalFactory :
AbpUserClaimsPrincipalFactory, ITransientDependency
{
public MyUserClaimsPrincipalFactory(
UserManager<IdentityUser> userManager,
RoleManager<IdentityRole> roleManager,
IOptions<IdentityOptions> options,
ICurrentPrincipalAccessor currentPrincipalAccessor,
IAbpClaimsPrincipalFactory abpClaimsPrincipalFactory) :
base(userManager, roleManager, options, currentPrincipalAccessor, abpClaimsPrincipalFactory)
{
}
[UnitOfWork]
public override async Task<ClaimsPrincipal> CreateAsync(Volo.Abp.Identity.IdentityUser user)
{
var principal = await base.CreateAsync(user);
principal.Identities
.First().AddClaim(new Claim("Test", "123"));
return principal;
}
}
}
or
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.Security.Claims;
using Volo.Abp.Users;
namespace BookStore
{
public class MyAbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
{
private readonly IdentityUserManager _identityUserManager;
public MyAbpClaimsPrincipalContributor(
IdentityUserManager identityUserManager)
{
_identityUserManager = identityUserManager;
}
public async Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
{
var identityUser = await _identityUserManager.GetUserAsync(context.ClaimsPrincipal);
var organizationUnits = await _identityUserManager.GetOrganizationUnitsAsync(identityUser);
}
}
}