mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-12 16:10:06 +01:00
- Update jsonwebtoken to latest version
- Update key algorithm handling when initializing key data
This commit is contained in:
parent
4a29bdfbc6
commit
a7d2830dd1
2 changed files with 3 additions and 3 deletions
|
|
@ -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"] }
|
||||||
|
|
|
||||||
|
|
@ -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)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue