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