1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Add OneOrMany contains claim validator

This commit is contained in:
Kévin Commaille
2022-11-28 11:54:20 +01:00
committed by Quentin Gliech
parent a2a3b3954e
commit f71f68c926
5 changed files with 66 additions and 19 deletions

View File

@ -154,7 +154,10 @@ async fn fail_verify_id_token_wrong_audience() {
assert_matches!(
error,
IdTokenError::Jwt(JwtVerificationError::WrongAudience)
IdTokenError::Jwt(JwtVerificationError::Claim(ClaimError::ValidationError {
claim: "aud",
..
}))
);
}

View File

@ -474,10 +474,7 @@ fn verify_client_jwt(
return Err("Wrong sub".into());
}
let aud = claims::AUD.extract_required(claims)?;
if !aud.contains(token_endpoint) {
return Err("Wrong aud".into());
}
claims::AUD.extract_required_with_options(claims, token_endpoint)?;
claims::EXP.extract_required_with_options(claims, TimeOptions::new(now()))?;