Skip to content

Commit

Permalink
testing patch (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaga authored Sep 25, 2023
1 parent 228654a commit 726191d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/jwt_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,19 @@ pub(crate) async fn validate_jwt(client: &Client, token: &str) -> EsiResult<Toke
"JWT issuer is incorrect",
)));
}
if token.claims["aud"].as_str().unwrap() != "EVE Online" {
return Err(EsiError::InvalidJWT(String::from(
"JWT audience field is incorrect",
)));
match token.claims["aud"].as_str() {
Some(aud) => {
if aud != "EVE Online" {
return Err(EsiError::InvalidJWT(String::from(
"JWT audience field is incorrect",
)));
}
},
None => {
return Err(EsiError::InvalidJWT(String::from(
"JWT audience field is incorrect",
)));
}
}
let token_claims = serde_json::from_value(token.claims)?;
Ok(token_claims)
Expand Down

0 comments on commit 726191d

Please sign in to comment.