@@ -647,7 +647,10 @@ impl ProviderMetadata {
647
647
let metadata = self . insecure_verify_metadata ( ) ?;
648
648
649
649
if metadata. issuer ( ) != issuer {
650
- return Err ( ProviderMetadataVerificationError :: IssuerUrlsDontMatch ) ;
650
+ return Err ( ProviderMetadataVerificationError :: IssuerUrlsDontMatch {
651
+ expected : issuer. to_owned ( ) ,
652
+ actual : metadata. issuer ( ) . to_owned ( ) ,
653
+ } ) ;
651
654
}
652
655
653
656
validate_url (
@@ -1064,8 +1067,13 @@ pub enum ProviderMetadataVerificationError {
1064
1067
UrlWithFragment ( & ' static str , Url ) ,
1065
1068
1066
1069
/// The issuer URL doesn't match the one that was discovered.
1067
- #[ error( "issuer URLs don't match" ) ]
1068
- IssuerUrlsDontMatch ,
1070
+ #[ error( "issuer URLs don't match: expected {expected:?}, got {actual:?}" ) ]
1071
+ IssuerUrlsDontMatch {
1072
+ /// The expected issuer URL.
1073
+ expected : String ,
1074
+ /// The issuer URL that was discovered.
1075
+ actual : String ,
1076
+ } ,
1069
1077
1070
1078
/// `openid` is missing from the supported scopes.
1071
1079
#[ error( "missing openid scope" ) ]
@@ -1314,7 +1322,7 @@ mod tests {
1314
1322
metadata. issuer = Some ( "https://example.com/" . to_owned ( ) ) ;
1315
1323
assert_matches ! (
1316
1324
metadata. clone( ) . validate( & issuer) ,
1317
- Err ( ProviderMetadataVerificationError :: IssuerUrlsDontMatch )
1325
+ Err ( ProviderMetadataVerificationError :: IssuerUrlsDontMatch { .. } )
1318
1326
) ;
1319
1327
1320
1328
// Err - Not https
0 commit comments