@@ -137,6 +137,12 @@ Metadata.ScopesSupported or
137137 element . ValueKind is JsonValueKind . Array &&
138138 OpenIddictHelpers . ValidateArrayElements ( element , JsonValueKind . String ) ,
139139
140+ // The following parameters MUST be formatted as JSON objects and only contain string values:
141+ Metadata . MtlsEndpointAliases
142+ => ( ( JsonElement ) value ) is JsonElement element &&
143+ element . ValueKind is JsonValueKind . Object &&
144+ OpenIddictHelpers . ValidateObjectElements ( element , JsonValueKind . String ) ,
145+
140146 // The following parameters MUST be formatted as booleans:
141147 Metadata . AuthorizationResponseIssParameterSupported or
142148 Metadata . RequirePushedAuthorizationRequests or
@@ -513,15 +519,9 @@ public ValueTask HandleAsync(HandleConfigurationResponseContext context)
513519 throw new ArgumentNullException ( nameof ( context ) ) ;
514520 }
515521
516- var aliases = context . Response [ Metadata . MtlsEndpointAliases ] ? . GetNamedParameters ( ) ;
517- if ( aliases is not { Count : > 0 } )
518- {
519- return default ;
520- }
521-
522522 // Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
523523 // that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
524- var endpoint = ( string ? ) aliases [ Metadata . DeviceAuthorizationEndpoint ] ;
524+ var endpoint = ( string ? ) context . Response [ Metadata . MtlsEndpointAliases ] ? [ Metadata . DeviceAuthorizationEndpoint ] ;
525525 if ( Uri . TryCreate ( endpoint , UriKind . Absolute , out Uri ? uri ) && ! OpenIddictHelpers . IsImplicitFileUri ( uri ) )
526526 {
527527 context . Configuration . MtlsDeviceAuthorizationEndpoint = uri ;
@@ -555,15 +555,9 @@ public ValueTask HandleAsync(HandleConfigurationResponseContext context)
555555 throw new ArgumentNullException ( nameof ( context ) ) ;
556556 }
557557
558- var aliases = context . Response [ Metadata . MtlsEndpointAliases ] ? . GetNamedParameters ( ) ;
559- if ( aliases is not { Count : > 0 } )
560- {
561- return default ;
562- }
563-
564558 // Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
565559 // that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
566- var endpoint = ( string ? ) aliases [ Metadata . IntrospectionEndpoint ] ;
560+ var endpoint = ( string ? ) context . Response [ Metadata . MtlsEndpointAliases ] ? [ Metadata . IntrospectionEndpoint ] ;
567561 if ( Uri . TryCreate ( endpoint , UriKind . Absolute , out Uri ? uri ) && ! OpenIddictHelpers . IsImplicitFileUri ( uri ) )
568562 {
569563 context . Configuration . MtlsIntrospectionEndpoint = uri ;
@@ -596,15 +590,9 @@ public ValueTask HandleAsync(HandleConfigurationResponseContext context)
596590 throw new ArgumentNullException ( nameof ( context ) ) ;
597591 }
598592
599- var aliases = context . Response [ Metadata . MtlsEndpointAliases ] ? . GetNamedParameters ( ) ;
600- if ( aliases is not { Count : > 0 } )
601- {
602- return default ;
603- }
604-
605593 // Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
606594 // that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
607- var endpoint = ( string ? ) aliases [ Metadata . PushedAuthorizationRequestEndpoint ] ;
595+ var endpoint = ( string ? ) context . Response [ Metadata . MtlsEndpointAliases ] ? [ Metadata . PushedAuthorizationRequestEndpoint ] ;
608596 if ( Uri . TryCreate ( endpoint , UriKind . Absolute , out Uri ? uri ) && ! OpenIddictHelpers . IsImplicitFileUri ( uri ) )
609597 {
610598 context . Configuration . MtlsPushedAuthorizationEndpoint = uri ;
@@ -637,15 +625,9 @@ public ValueTask HandleAsync(HandleConfigurationResponseContext context)
637625 throw new ArgumentNullException ( nameof ( context ) ) ;
638626 }
639627
640- var aliases = context . Response [ Metadata . MtlsEndpointAliases ] ? . GetNamedParameters ( ) ;
641- if ( aliases is not { Count : > 0 } )
642- {
643- return default ;
644- }
645-
646628 // Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
647629 // that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
648- var endpoint = ( string ? ) aliases [ Metadata . RevocationEndpoint ] ;
630+ var endpoint = ( string ? ) context . Response [ Metadata . MtlsEndpointAliases ] ? [ Metadata . RevocationEndpoint ] ;
649631 if ( Uri . TryCreate ( endpoint , UriKind . Absolute , out Uri ? uri ) && ! OpenIddictHelpers . IsImplicitFileUri ( uri ) )
650632 {
651633 context . Configuration . MtlsRevocationEndpoint = uri ;
@@ -678,15 +660,9 @@ public ValueTask HandleAsync(HandleConfigurationResponseContext context)
678660 throw new ArgumentNullException ( nameof ( context ) ) ;
679661 }
680662
681- var aliases = context . Response [ Metadata . MtlsEndpointAliases ] ? . GetNamedParameters ( ) ;
682- if ( aliases is not { Count : > 0 } )
683- {
684- return default ;
685- }
686-
687663 // Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
688664 // that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
689- var endpoint = ( string ? ) aliases [ Metadata . TokenEndpoint ] ;
665+ var endpoint = ( string ? ) context . Response [ Metadata . MtlsEndpointAliases ] ? [ Metadata . TokenEndpoint ] ;
690666 if ( Uri . TryCreate ( endpoint , UriKind . Absolute , out Uri ? uri ) && ! OpenIddictHelpers . IsImplicitFileUri ( uri ) )
691667 {
692668 context . Configuration . MtlsTokenEndpoint = uri ;
@@ -719,15 +695,9 @@ public ValueTask HandleAsync(HandleConfigurationResponseContext context)
719695 throw new ArgumentNullException ( nameof ( context ) ) ;
720696 }
721697
722- var aliases = context . Response [ Metadata . MtlsEndpointAliases ] ? . GetNamedParameters ( ) ;
723- if ( aliases is not { Count : > 0 } )
724- {
725- return default ;
726- }
727-
728698 // Note: as recommended by the specification, values present in the "mtls_endpoint_aliases" node
729699 // that can't be recognized as OAuth 2.0 endpoints or are not valid URIs are simply ignored.
730- var endpoint = ( string ? ) aliases [ Metadata . UserInfoEndpoint ] ;
700+ var endpoint = ( string ? ) context . Response [ Metadata . MtlsEndpointAliases ] ? [ Metadata . UserInfoEndpoint ] ;
731701 if ( Uri . TryCreate ( endpoint , UriKind . Absolute , out Uri ? uri ) && ! OpenIddictHelpers . IsImplicitFileUri ( uri ) )
732702 {
733703 context . Configuration . MtlsUserInfoEndpoint = uri ;
0 commit comments