|
|
@ -13,6 +13,7 @@ using System.Text; |
|
|
using System.Text.Json; |
|
|
using System.Text.Json; |
|
|
using Microsoft.Extensions.Logging; |
|
|
using Microsoft.Extensions.Logging; |
|
|
using Microsoft.Extensions.Primitives; |
|
|
using Microsoft.Extensions.Primitives; |
|
|
|
|
|
using Microsoft.IdentityModel.JsonWebTokens; |
|
|
using Microsoft.IdentityModel.Tokens; |
|
|
using Microsoft.IdentityModel.Tokens; |
|
|
using OpenIddict.Extensions; |
|
|
using OpenIddict.Extensions; |
|
|
using static OpenIddict.Abstractions.OpenIddictExceptions; |
|
|
using static OpenIddict.Abstractions.OpenIddictExceptions; |
|
|
@ -1734,7 +1735,12 @@ public static partial class OpenIddictClientHandlers |
|
|
|
|
|
|
|
|
// The following claims MUST be represented as unique strings or array of strings.
|
|
|
// The following claims MUST be represented as unique strings or array of strings.
|
|
|
Claims.Audience or Claims.AuthenticationMethodReference |
|
|
Claims.Audience or Claims.AuthenticationMethodReference |
|
|
=> values.TrueForAll(static value => value.ValueType is ClaimValueTypes.String), |
|
|
=> values.TrueForAll(static value => value.ValueType is ClaimValueTypes.String) || |
|
|
|
|
|
// Note: a unique claim using the special JSON_ARRAY claim value type is allowed
|
|
|
|
|
|
// if the individual elements of the parsed JSON array are all string values.
|
|
|
|
|
|
(values is [{ ValueType: JsonClaimValueTypes.JsonArray, Value: string value }] && |
|
|
|
|
|
JsonSerializer.Deserialize<JsonElement>(value) is { ValueKind: JsonValueKind.Array } element && |
|
|
|
|
|
OpenIddictHelpers.ValidateArrayElements(element, JsonValueKind.String)), |
|
|
|
|
|
|
|
|
// The following claims MUST be represented as unique numeric dates.
|
|
|
// The following claims MUST be represented as unique numeric dates.
|
|
|
Claims.AuthenticationTime or Claims.ExpiresAt or Claims.IssuedAt or Claims.NotBefore |
|
|
Claims.AuthenticationTime or Claims.ExpiresAt or Claims.IssuedAt or Claims.NotBefore |
|
|
@ -3079,7 +3085,12 @@ public static partial class OpenIddictClientHandlers |
|
|
|
|
|
|
|
|
// The following claims MUST be represented as unique strings or array of strings.
|
|
|
// The following claims MUST be represented as unique strings or array of strings.
|
|
|
Claims.Audience or Claims.AuthenticationMethodReference |
|
|
Claims.Audience or Claims.AuthenticationMethodReference |
|
|
=> values.TrueForAll(static value => value.ValueType is ClaimValueTypes.String), |
|
|
=> values.TrueForAll(static value => value.ValueType is ClaimValueTypes.String) || |
|
|
|
|
|
// Note: a unique claim using the special JSON_ARRAY claim value type is allowed
|
|
|
|
|
|
// if the individual elements of the parsed JSON array are all string values.
|
|
|
|
|
|
(values is [{ ValueType: JsonClaimValueTypes.JsonArray, Value: string value }] && |
|
|
|
|
|
JsonSerializer.Deserialize<JsonElement>(value) is { ValueKind: JsonValueKind.Array } element && |
|
|
|
|
|
OpenIddictHelpers.ValidateArrayElements(element, JsonValueKind.String)), |
|
|
|
|
|
|
|
|
// The following claims MUST be represented as unique numeric dates.
|
|
|
// The following claims MUST be represented as unique numeric dates.
|
|
|
Claims.AuthenticationTime or Claims.ExpiresAt or Claims.IssuedAt or Claims.NotBefore |
|
|
Claims.AuthenticationTime or Claims.ExpiresAt or Claims.IssuedAt or Claims.NotBefore |
|
|
@ -4271,7 +4282,12 @@ public static partial class OpenIddictClientHandlers |
|
|
{ |
|
|
{ |
|
|
// The following claims MUST be represented as unique strings or array of strings.
|
|
|
// The following claims MUST be represented as unique strings or array of strings.
|
|
|
Claims.Private.Audience or Claims.Private.Resource or Claims.Private.Presenter |
|
|
Claims.Private.Audience or Claims.Private.Resource or Claims.Private.Presenter |
|
|
=> values.TrueForAll(static value => value.ValueType is ClaimValueTypes.String), |
|
|
=> values.TrueForAll(static value => value.ValueType is ClaimValueTypes.String) || |
|
|
|
|
|
// Note: a unique claim using the special JSON_ARRAY claim value type is allowed
|
|
|
|
|
|
// if the individual elements of the parsed JSON array are all string values.
|
|
|
|
|
|
(values is [{ ValueType: JsonClaimValueTypes.JsonArray, Value: string value }] && |
|
|
|
|
|
JsonSerializer.Deserialize<JsonElement>(value) is { ValueKind: JsonValueKind.Array } element && |
|
|
|
|
|
OpenIddictHelpers.ValidateArrayElements(element, JsonValueKind.String)), |
|
|
|
|
|
|
|
|
// The following claims MUST be represented as unique integers.
|
|
|
// The following claims MUST be represented as unique integers.
|
|
|
Claims.Private.StateTokenLifetime |
|
|
Claims.Private.StateTokenLifetime |
|
|
@ -7094,7 +7110,12 @@ public static partial class OpenIddictClientHandlers |
|
|
{ |
|
|
{ |
|
|
// The following claims MUST be represented as unique strings or array of strings.
|
|
|
// The following claims MUST be represented as unique strings or array of strings.
|
|
|
Claims.Private.Audience or Claims.Private.Resource or Claims.Private.Presenter |
|
|
Claims.Private.Audience or Claims.Private.Resource or Claims.Private.Presenter |
|
|
=> values.TrueForAll(static value => value.ValueType is ClaimValueTypes.String), |
|
|
=> values.TrueForAll(static value => value.ValueType is ClaimValueTypes.String) || |
|
|
|
|
|
// Note: a unique claim using the special JSON_ARRAY claim value type is allowed
|
|
|
|
|
|
// if the individual elements of the parsed JSON array are all string values.
|
|
|
|
|
|
(values is [{ ValueType: JsonClaimValueTypes.JsonArray, Value: string value }] && |
|
|
|
|
|
JsonSerializer.Deserialize<JsonElement>(value) is { ValueKind: JsonValueKind.Array } element && |
|
|
|
|
|
OpenIddictHelpers.ValidateArrayElements(element, JsonValueKind.String)), |
|
|
|
|
|
|
|
|
// The following claims MUST be represented as unique integers.
|
|
|
// The following claims MUST be represented as unique integers.
|
|
|
Claims.Private.StateTokenLifetime |
|
|
Claims.Private.StateTokenLifetime |
|
|
|