|
|
@ -425,7 +425,7 @@ public static partial class OpenIddictValidationHandlers |
|
|
identity.AddClaim(new Claim( |
|
|
identity.AddClaim(new Claim( |
|
|
type : parameter.Key, |
|
|
type : parameter.Key, |
|
|
value : item.ToString()!, |
|
|
value : item.ToString()!, |
|
|
valueType : GetClaimValueType(item.ValueKind), |
|
|
valueType : GetClaimValueType(item), |
|
|
issuer : issuer, |
|
|
issuer : issuer, |
|
|
originalIssuer: issuer, |
|
|
originalIssuer: issuer, |
|
|
subject : identity)); |
|
|
subject : identity)); |
|
|
@ -438,7 +438,7 @@ public static partial class OpenIddictValidationHandlers |
|
|
identity.AddClaim(new Claim( |
|
|
identity.AddClaim(new Claim( |
|
|
type : parameter.Key, |
|
|
type : parameter.Key, |
|
|
value : value.ToString()!, |
|
|
value : value.ToString()!, |
|
|
valueType : GetClaimValueType(value.ValueKind), |
|
|
valueType : GetClaimValueType(value), |
|
|
issuer : issuer, |
|
|
issuer : issuer, |
|
|
originalIssuer: issuer, |
|
|
originalIssuer: issuer, |
|
|
subject : identity)); |
|
|
subject : identity)); |
|
|
@ -448,11 +448,17 @@ public static partial class OpenIddictValidationHandlers |
|
|
|
|
|
|
|
|
context.Principal = new ClaimsPrincipal(identity); |
|
|
context.Principal = new ClaimsPrincipal(identity); |
|
|
|
|
|
|
|
|
static string GetClaimValueType(JsonValueKind kind) => kind switch |
|
|
static string GetClaimValueType(JsonElement element) => element.ValueKind switch |
|
|
{ |
|
|
{ |
|
|
JsonValueKind.String => ClaimValueTypes.String, |
|
|
JsonValueKind.String => ClaimValueTypes.String, |
|
|
JsonValueKind.Number => ClaimValueTypes.Integer64, |
|
|
JsonValueKind.True or JsonValueKind.False => ClaimValueTypes.Boolean, |
|
|
JsonValueKind.True or JsonValueKind.False => ClaimValueTypes.Boolean, |
|
|
|
|
|
|
|
|
JsonValueKind.Number when element.TryGetInt32(out _) => ClaimValueTypes.Integer32, |
|
|
|
|
|
JsonValueKind.Number when element.TryGetInt64(out _) => ClaimValueTypes.Integer64, |
|
|
|
|
|
JsonValueKind.Number when element.TryGetUInt32(out _) => ClaimValueTypes.UInteger32, |
|
|
|
|
|
JsonValueKind.Number when element.TryGetUInt64(out _) => ClaimValueTypes.UInteger64, |
|
|
|
|
|
JsonValueKind.Number when element.TryGetDouble(out _) => ClaimValueTypes.Double, |
|
|
|
|
|
|
|
|
JsonValueKind.Null or JsonValueKind.Undefined => JsonClaimValueTypes.JsonNull, |
|
|
JsonValueKind.Null or JsonValueKind.Undefined => JsonClaimValueTypes.JsonNull, |
|
|
JsonValueKind.Array => JsonClaimValueTypes.JsonArray, |
|
|
JsonValueKind.Array => JsonClaimValueTypes.JsonArray, |
|
|
JsonValueKind.Object or _ => JsonClaimValueTypes.Json |
|
|
JsonValueKind.Object or _ => JsonClaimValueTypes.Json |
|
|
|