Skip to content

Commit

Permalink
feat! Update on interval
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellkongsvik committed Oct 2, 2023
1 parent 229c193 commit 99b8bd6
Show file tree
Hide file tree
Showing 9 changed files with 345 additions and 252 deletions.
1 change: 1 addition & 0 deletions axum-jwks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jsonwebtoken = { version = "8", default-features = false }
reqwest = { version = "0.11", features = ["json"] }
serde = { version = "1", features = ["derive"] }
thiserror = { version = "1" }
tokio = "1"
tracing = { version = "0.1" }

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions axum-jwks/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use axum::{
};
use serde::de::DeserializeOwned;

use crate::{Jwks, Token, TokenError};
use crate::{KeyManager, Token, TokenError};

pub struct Claims<C: DeserializeOwned + ParseTokenClaims>(pub C);

Expand Down Expand Up @@ -82,16 +82,16 @@ pub trait ParseTokenClaims {
impl<S, C> FromRequestParts<S> for Claims<C>
where
C: DeserializeOwned + ParseTokenClaims,
Jwks: FromRef<S>,
KeyManager: FromRef<S>,
S: Send + Sync,
{
type Rejection = C::Rejection;

async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
let jwks = Jwks::from_ref(state);
let key_manager = KeyManager::from_ref(state);
let token = Token::from_request_parts(parts, state).await?;

let token_data = jwks.validate_claims(token.value())?;
let token_data = key_manager.validate_claims(token.value()).await?;

Ok(Claims(token_data.claims))
}
Expand Down
221 changes: 0 additions & 221 deletions axum-jwks/src/jwks.rs

This file was deleted.

Loading

0 comments on commit 99b8bd6

Please sign in to comment.