|
|
|
|
@ -4,12 +4,15 @@ using System.Security.Claims;
|
|
|
|
|
using IdentityModel;
|
|
|
|
|
using IdentityServer4.Services;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Volo.Abp.Security.Claims;
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.IdentityServer
|
|
|
|
|
{
|
|
|
|
|
public class AbpClaimsService : DefaultClaimsService
|
|
|
|
|
{
|
|
|
|
|
protected readonly AbpClaimsPrincipalOptions Options;
|
|
|
|
|
|
|
|
|
|
private static readonly string[] AdditionalOptionalClaimNames =
|
|
|
|
|
{
|
|
|
|
|
AbpClaimTypes.TenantId,
|
|
|
|
|
@ -20,20 +23,21 @@ namespace Volo.Abp.IdentityServer
|
|
|
|
|
JwtClaimTypes.FamilyName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public AbpClaimsService(IProfileService profile, ILogger<DefaultClaimsService> logger)
|
|
|
|
|
public AbpClaimsService(
|
|
|
|
|
IProfileService profile,
|
|
|
|
|
ILogger<DefaultClaimsService> logger,
|
|
|
|
|
IOptions<AbpClaimsPrincipalOptions> options)
|
|
|
|
|
: base(profile, logger)
|
|
|
|
|
{
|
|
|
|
|
Options = options.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override IEnumerable<string> FilterRequestedClaimTypes(IEnumerable<string> claimTypes)
|
|
|
|
|
{
|
|
|
|
|
return base.FilterRequestedClaimTypes(claimTypes)
|
|
|
|
|
.Union(new []{
|
|
|
|
|
AbpClaimTypes.TenantId,
|
|
|
|
|
AbpClaimTypes.EditionId
|
|
|
|
|
});
|
|
|
|
|
.Union(Options.RequestedClaims);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override IEnumerable<Claim> GetOptionalClaims(ClaimsPrincipal subject)
|
|
|
|
|
{
|
|
|
|
|
return base.GetOptionalClaims(subject)
|
|
|
|
|
@ -52,4 +56,4 @@ namespace Volo.Abp.IdentityServer
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|