|
|
|
@ -137,6 +137,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 |
|
|
|
@ -513,15 +519,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; |
|
|
|
@ -555,15 +555,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; |
|
|
|
@ -596,15 +590,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; |
|
|
|
@ -637,15 +625,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; |
|
|
|
@ -678,15 +660,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; |
|
|
|
@ -719,15 +695,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; |
|
|
|
|