|
|
|
@ -136,6 +136,12 @@ public static partial class OpenIddictClientHandlers |
|
|
|
element.ValueKind is JsonValueKind.Array && |
|
|
|
OpenIddictHelpers.ValidateArrayElements(element, JsonValueKind.String), |
|
|
|
|
|
|
|
// The following parameters MUST be formatted as JSON objects and only contain string values:
|
|
|
|
Metadata.MtlsEndpointAliases |
|
|
|
=> ((JsonElement) value) is JsonElement element && |
|
|
|
element.ValueKind is JsonValueKind.Object && |
|
|
|
OpenIddictHelpers.ValidateObjectElements(element, JsonValueKind.String), |
|
|
|
|
|
|
|
// The following parameters MUST be formatted as booleans:
|
|
|
|
Metadata.AuthorizationResponseIssParameterSupported or |
|
|
|
Metadata.RequirePushedAuthorizationRequests or |
|
|
|
@ -512,15 +518,9 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new ArgumentNullException(nameof(context)); |
|
|
|
} |
|
|
|
|
|
|
|
var aliases = context.Response[Metadata.MtlsEndpointAliases]?.GetNamedParameters(); |
|
|
|
if (aliases is not { Count: > 0 }) |
|
|
|
{ |
|
|
|
return default; |
|
|
|
} |
|
|
|
|
|
|
|
// Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
|
|
|
|
// that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
|
|
|
|
var endpoint = (string?) aliases[Metadata.DeviceAuthorizationEndpoint]; |
|
|
|
var endpoint = (string?) context.Response[Metadata.MtlsEndpointAliases]?[Metadata.DeviceAuthorizationEndpoint]; |
|
|
|
if (Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) && !OpenIddictHelpers.IsImplicitFileUri(uri)) |
|
|
|
{ |
|
|
|
context.Configuration.MtlsDeviceAuthorizationEndpoint = uri; |
|
|
|
@ -554,15 +554,9 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new ArgumentNullException(nameof(context)); |
|
|
|
} |
|
|
|
|
|
|
|
var aliases = context.Response[Metadata.MtlsEndpointAliases]?.GetNamedParameters(); |
|
|
|
if (aliases is not { Count: > 0 }) |
|
|
|
{ |
|
|
|
return default; |
|
|
|
} |
|
|
|
|
|
|
|
// Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
|
|
|
|
// that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
|
|
|
|
var endpoint = (string?) aliases[Metadata.IntrospectionEndpoint]; |
|
|
|
var endpoint = (string?) context.Response[Metadata.MtlsEndpointAliases]?[Metadata.IntrospectionEndpoint]; |
|
|
|
if (Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) && !OpenIddictHelpers.IsImplicitFileUri(uri)) |
|
|
|
{ |
|
|
|
context.Configuration.MtlsIntrospectionEndpoint = uri; |
|
|
|
@ -595,15 +589,9 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new ArgumentNullException(nameof(context)); |
|
|
|
} |
|
|
|
|
|
|
|
var aliases = context.Response[Metadata.MtlsEndpointAliases]?.GetNamedParameters(); |
|
|
|
if (aliases is not { Count: > 0 }) |
|
|
|
{ |
|
|
|
return default; |
|
|
|
} |
|
|
|
|
|
|
|
// Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
|
|
|
|
// that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
|
|
|
|
var endpoint = (string?) aliases[Metadata.PushedAuthorizationRequestEndpoint]; |
|
|
|
var endpoint = (string?) context.Response[Metadata.MtlsEndpointAliases]?[Metadata.PushedAuthorizationRequestEndpoint]; |
|
|
|
if (Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) && !OpenIddictHelpers.IsImplicitFileUri(uri)) |
|
|
|
{ |
|
|
|
context.Configuration.MtlsPushedAuthorizationEndpoint = uri; |
|
|
|
@ -636,15 +624,9 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new ArgumentNullException(nameof(context)); |
|
|
|
} |
|
|
|
|
|
|
|
var aliases = context.Response[Metadata.MtlsEndpointAliases]?.GetNamedParameters(); |
|
|
|
if (aliases is not { Count: > 0 }) |
|
|
|
{ |
|
|
|
return default; |
|
|
|
} |
|
|
|
|
|
|
|
// Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
|
|
|
|
// that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
|
|
|
|
var endpoint = (string?) aliases[Metadata.RevocationEndpoint]; |
|
|
|
var endpoint = (string?) context.Response[Metadata.MtlsEndpointAliases]?[Metadata.RevocationEndpoint]; |
|
|
|
if (Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) && !OpenIddictHelpers.IsImplicitFileUri(uri)) |
|
|
|
{ |
|
|
|
context.Configuration.MtlsRevocationEndpoint = uri; |
|
|
|
@ -677,15 +659,9 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new ArgumentNullException(nameof(context)); |
|
|
|
} |
|
|
|
|
|
|
|
var aliases = context.Response[Metadata.MtlsEndpointAliases]?.GetNamedParameters(); |
|
|
|
if (aliases is not { Count: > 0 }) |
|
|
|
{ |
|
|
|
return default; |
|
|
|
} |
|
|
|
|
|
|
|
// Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
|
|
|
|
// that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
|
|
|
|
var endpoint = (string?) aliases[Metadata.TokenEndpoint]; |
|
|
|
var endpoint = (string?) context.Response[Metadata.MtlsEndpointAliases]?[Metadata.TokenEndpoint]; |
|
|
|
if (Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) && !OpenIddictHelpers.IsImplicitFileUri(uri)) |
|
|
|
{ |
|
|
|
context.Configuration.MtlsTokenEndpoint = uri; |
|
|
|
@ -718,15 +694,9 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new ArgumentNullException(nameof(context)); |
|
|
|
} |
|
|
|
|
|
|
|
var aliases = context.Response[Metadata.MtlsEndpointAliases]?.GetNamedParameters(); |
|
|
|
if (aliases is not { Count: > 0 }) |
|
|
|
{ |
|
|
|
return default; |
|
|
|
} |
|
|
|
|
|
|
|
// Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
|
|
|
|
// that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
|
|
|
|
var endpoint = (string?) aliases[Metadata.UserInfoEndpoint]; |
|
|
|
var endpoint = (string?) context.Response[Metadata.MtlsEndpointAliases]?[Metadata.UserInfoEndpoint]; |
|
|
|
if (Uri.TryCreate(endpoint, UriKind.Absolute, out Uri? uri) && !OpenIddictHelpers.IsImplicitFileUri(uri)) |
|
|
|
{ |
|
|
|
context.Configuration.MtlsUserInfoEndpoint = uri; |
|
|
|
|