- Update jsonwebtoken to latest version

- Update key algorithm handling when initializing key data
This commit is contained in:
Vladislav Manchev 2023-11-03 21:11:27 +02:00 committed by cduvray
parent 4a29bdfbc6
commit a7d2830dd1
2 changed files with 3 additions and 3 deletions

View file

@ -15,7 +15,7 @@ chrono = { version = "0.4", optional = true }
futures-util = "0.3" futures-util = "0.3"
futures-core = "0.3" futures-core = "0.3"
headers = "0.3" headers = "0.3"
jsonwebtoken = "8.3" jsonwebtoken = "9.1.0"
http = "0.2" http = "0.2"
pin-project = "1.0" pin-project = "1.0"
reqwest = { version = "0.11", default-features = false, features = ["json"] } reqwest = { version = "0.11", default-features = false, features = ["json"] }

View file

@ -1,4 +1,4 @@
use std::sync::Arc; use std::{str::FromStr, sync::Arc};
use jsonwebtoken::{jwk::Jwk, Algorithm, DecodingKey, Header}; use jsonwebtoken::{jwk::Jwk, Algorithm, DecodingKey, Header};
@ -29,7 +29,7 @@ impl KeyData {
pub fn from_jwk(key: &Jwk) -> Result<KeyData, jsonwebtoken::errors::Error> { pub fn from_jwk(key: &Jwk) -> Result<KeyData, jsonwebtoken::errors::Error> {
Ok(KeyData { Ok(KeyData {
kid: key.common.key_id.clone(), kid: key.common.key_id.clone(),
alg: vec![key.common.algorithm.unwrap_or(Algorithm::RS256)], // TODO: is this good default? alg: vec![Algorithm::from_str(key.common.key_algorithm.unwrap().to_string().as_str())?],
key: DecodingKey::from_jwk(key)?, key: DecodingKey::from_jwk(key)?,
}) })
} }