@@ -692,10 +692,6 @@ impl ProviderMetadata {
692
692
. token_endpoint_auth_signing_alg_values_supported
693
693
. iter ( )
694
694
. flatten ( ) ,
695
- metadata
696
- . token_endpoint_auth_methods_supported
697
- . iter ( )
698
- . flatten ( ) ,
699
695
) ?;
700
696
701
697
if let Some ( url) = & metadata. revocation_endpoint {
@@ -708,33 +704,18 @@ impl ProviderMetadata {
708
704
. revocation_endpoint_auth_signing_alg_values_supported
709
705
. iter ( )
710
706
. flatten ( ) ,
711
- metadata
712
- . revocation_endpoint_auth_methods_supported
713
- . iter ( )
714
- . flatten ( ) ,
715
707
) ?;
716
708
717
709
if let Some ( url) = & metadata. introspection_endpoint {
718
710
validate_url ( "introspection_endpoint" , url, ExtraUrlRestrictions :: None ) ?;
719
711
}
720
712
721
- // The list can also contain token types so remove them as we don't need to
722
- // check them.
723
- let introspection_methods = metadata
724
- . introspection_endpoint_auth_methods_supported
725
- . as_ref ( )
726
- . map ( |v| {
727
- v. iter ( )
728
- . filter_map ( AuthenticationMethodOrAccessTokenType :: authentication_method)
729
- . collect :: < Vec < _ > > ( )
730
- } ) ;
731
713
validate_signing_alg_values_supported (
732
714
"introspection_endpoint" ,
733
715
metadata
734
716
. introspection_endpoint_auth_signing_alg_values_supported
735
717
. iter ( )
736
718
. flatten ( ) ,
737
- introspection_methods. into_iter ( ) . flatten ( ) ,
738
719
) ?;
739
720
740
721
if let Some ( url) = & metadata. userinfo_endpoint {
@@ -1099,12 +1080,6 @@ pub enum ProviderMetadataVerificationError {
1099
1080
#[ error( "missing `implicit` grant type" ) ]
1100
1081
GrantTypesMissingImplicit ,
1101
1082
1102
- /// The given endpoint is missing auth signing algorithm values, but they
1103
- /// are required because it supports at least one of the `client_secret_jwt`
1104
- /// or `private_key_jwt` authentication methods.
1105
- #[ error( "{0} missing auth signing algorithm values" ) ]
1106
- MissingAuthSigningAlgValues ( & ' static str ) ,
1107
-
1108
1083
/// `none` is in the given endpoint's signing algorithm values, but is not
1109
1084
/// allowed.
1110
1085
#[ error( "{0} signing algorithm values contain `none`" ) ]
@@ -1176,32 +1151,14 @@ fn validate_url(
1176
1151
fn validate_signing_alg_values_supported < ' a > (
1177
1152
endpoint : & ' static str ,
1178
1153
values : impl Iterator < Item = & ' a JsonWebSignatureAlg > ,
1179
- mut methods : impl Iterator < Item = & ' a OAuthClientAuthenticationMethod > ,
1180
1154
) -> Result < ( ) , ProviderMetadataVerificationError > {
1181
- let mut no_values = true ;
1182
-
1183
1155
for value in values {
1184
1156
if * value == JsonWebSignatureAlg :: None {
1185
1157
return Err ( ProviderMetadataVerificationError :: SigningAlgValuesWithNone (
1186
1158
endpoint,
1187
1159
) ) ;
1188
1160
}
1189
-
1190
- no_values = false ;
1191
1161
}
1192
-
1193
- if no_values
1194
- && methods. any ( |method| {
1195
- matches ! (
1196
- method,
1197
- OAuthClientAuthenticationMethod :: ClientSecretJwt
1198
- | OAuthClientAuthenticationMethod :: PrivateKeyJwt
1199
- )
1200
- } )
1201
- {
1202
- return Err ( ProviderMetadataVerificationError :: MissingAuthSigningAlgValues ( endpoint) ) ;
1203
- }
1204
-
1205
1162
Ok ( ( ) )
1206
1163
}
1207
1164
@@ -1543,36 +1500,32 @@ mod tests {
1543
1500
Some ( vec ! [ JsonWebSignatureAlg :: Rs256 , JsonWebSignatureAlg :: EdDsa ] ) ;
1544
1501
metadata. clone ( ) . validate ( & issuer) . unwrap ( ) ;
1545
1502
1546
- // Err - `client_secret_jwt` without signing alg values.
1503
+ // Ok - `client_secret_jwt` with signing alg values.
1547
1504
metadata. token_endpoint_auth_methods_supported =
1548
1505
Some ( vec ! [ OAuthClientAuthenticationMethod :: ClientSecretJwt ] ) ;
1549
- metadata. token_endpoint_auth_signing_alg_values_supported = None ;
1550
- let endpoint = assert_matches ! (
1551
- metadata. clone( ) . validate( & issuer) ,
1552
- Err ( ProviderMetadataVerificationError :: MissingAuthSigningAlgValues ( endpoint) ) => endpoint
1553
- ) ;
1554
- assert_eq ! ( endpoint, "token_endpoint" ) ;
1555
-
1556
- // Ok - `client_secret_jwt` with signing alg values.
1557
1506
metadata. token_endpoint_auth_signing_alg_values_supported =
1558
1507
Some ( vec ! [ JsonWebSignatureAlg :: Rs256 ] ) ;
1559
1508
metadata. clone ( ) . validate ( & issuer) . unwrap ( ) ;
1560
1509
1561
- // Err - `private_key_jwt` without signing alg values.
1510
+ // Ok - `private_key_jwt` with signing alg values.
1562
1511
metadata. token_endpoint_auth_methods_supported =
1563
1512
Some ( vec ! [ OAuthClientAuthenticationMethod :: PrivateKeyJwt ] ) ;
1564
- metadata. token_endpoint_auth_signing_alg_values_supported = None ;
1565
- let endpoint = assert_matches ! (
1566
- metadata. clone( ) . validate( & issuer) ,
1567
- Err ( ProviderMetadataVerificationError :: MissingAuthSigningAlgValues ( endpoint) ) => endpoint
1568
- ) ;
1569
- assert_eq ! ( endpoint, "token_endpoint" ) ;
1570
-
1571
- // Ok - `private_key_jwt` with signing alg values.
1572
1513
metadata. token_endpoint_auth_signing_alg_values_supported =
1573
1514
Some ( vec ! [ JsonWebSignatureAlg :: Rs256 ] ) ;
1574
1515
metadata. clone ( ) . validate ( & issuer) . unwrap ( ) ;
1575
1516
1517
+ // Ok - `client_secret_jwt` without signing alg values.
1518
+ metadata. token_endpoint_auth_methods_supported =
1519
+ Some ( vec ! [ OAuthClientAuthenticationMethod :: ClientSecretJwt ] ) ;
1520
+ metadata. token_endpoint_auth_signing_alg_values_supported = None ;
1521
+ metadata. clone ( ) . validate ( & issuer) . unwrap ( ) ;
1522
+
1523
+ // Ok - `private_key_jwt` without signing alg values.
1524
+ metadata. token_endpoint_auth_methods_supported =
1525
+ Some ( vec ! [ OAuthClientAuthenticationMethod :: PrivateKeyJwt ] ) ;
1526
+ metadata. token_endpoint_auth_signing_alg_values_supported = None ;
1527
+ metadata. clone ( ) . validate ( & issuer) . unwrap ( ) ;
1528
+
1576
1529
// Ok - Other auth methods without signing alg values.
1577
1530
metadata. token_endpoint_auth_methods_supported = Some ( vec ! [
1578
1531
OAuthClientAuthenticationMethod :: ClientSecretBasic ,
0 commit comments