diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs index 2c64234992..17afdc38e4 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.AspNetCore.Security.Claims mapClaims .Select( claim => new Claim( - mapOptions.Maps[claim.Type], + mapOptions.Maps[claim.Type](), claim.Value, claim.ValueType, claim.Issuer diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapOptions.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapOptions.cs index a5eabd76bf..18f332f757 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapOptions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapOptions.cs @@ -1,19 +1,20 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Volo.Abp.Security.Claims; namespace Volo.Abp.AspNetCore.Security.Claims { public class AbpClaimsMapOptions { - public Dictionary Maps { get; } + public Dictionary> Maps { get; } public AbpClaimsMapOptions() { - Maps = new Dictionary() + Maps = new Dictionary>() { - { "sub", AbpClaimTypes.UserId }, - { "role", AbpClaimTypes.Role }, - { "email", AbpClaimTypes.Email }, + { "sub", () => AbpClaimTypes.UserId }, + { "role", () => AbpClaimTypes.Role }, + { "email", () => AbpClaimTypes.Email }, }; } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs index 2f9f13fdfe..d7544ebf0d 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs @@ -84,8 +84,8 @@ namespace Volo.Abp.AspNetCore.Mvc Configure(options => { - options.Maps.Add("SerialNumber", ClaimTypes.SerialNumber); - options.Maps.Add("DateOfBirth", ClaimTypes.DateOfBirth); + options.Maps.Add("SerialNumber", () => ClaimTypes.SerialNumber); + options.Maps.Add("DateOfBirth", () => ClaimTypes.DateOfBirth); }); }