From b303cef28f2ece2156c7cae711d8415bbb3e6fc3 Mon Sep 17 00:00:00 2001 From: mae <26093674+MaeIsBad@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:40:36 +0200 Subject: [PATCH] Remove jwks_client dependency --- Cargo.toml | 3 +-- src/auth0/errors.rs | 2 -- src/auth0/mod.rs | 5 ----- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2f23a37..b23807f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ rust-version = "1.72" [features] default = ["tracing_opentelemetry"] -auth0 = ["rand", "redis", "jsonwebtoken", "jwks_client_rs", "chrono", "chacha20poly1305", "dashmap", "tracing"] +auth0 = ["rand", "redis", "jsonwebtoken", "chrono", "chacha20poly1305", "dashmap", "tracing"] gzip = ["reqwest/gzip"] redis-tls = ["redis/tls", "redis/tokio-native-tls-comp"] tracing_opentelemetry = [ "tracing_opentelemetry_0_23" ] @@ -33,7 +33,6 @@ dashmap = {version = "6.0", optional = true} futures = "0.3" futures-util = "0.3" jsonwebtoken = {version = "9.0", optional = true} -jwks_client_rs = {version = "0.5", optional = true} rand = {version = "0.8", optional = true} redis = {version = "0.23", features = ["tokio-comp"], optional = true} reqwest = {version = "0.12", features = ["json", "multipart", "stream"]} diff --git a/src/auth0/errors.rs b/src/auth0/errors.rs index 7512734..54b3333 100644 --- a/src/auth0/errors.rs +++ b/src/auth0/errors.rs @@ -10,8 +10,6 @@ pub enum Auth0Error { JwtFetchError(u16, String, reqwest::Error), #[error("failed to deserialize jwt from {0}. {1}")] JwtFetchDeserializationError(String, reqwest::Error), - #[error(transparent)] - JwksClientError(#[from] jwks_client_rs::JwksClientError), #[error("failed to fetch jwt from {0}. Status code: {0}; error: {1}")] JwksHttpError(String, reqwest::Error), #[error("redis error: {0}")] diff --git a/src/auth0/mod.rs b/src/auth0/mod.rs index 955e14d..c876e7c 100644 --- a/src/auth0/mod.rs +++ b/src/auth0/mod.rs @@ -3,8 +3,6 @@ use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard}; use std::time::Duration; -use jwks_client_rs::source::WebSource; -use jwks_client_rs::JwksClient; use reqwest::Client; use tokio::task::JoinHandle; use tokio::time::Interval; @@ -41,14 +39,12 @@ impl Auth0 { .build(config.jwks_url().to_owned()) .map_err(|err| Auth0Error::JwksHttpError(config.token_url().as_str().to_string(), err))?; - let jwks_client = JwksClient::builder().build(source); let token: Token = get_token(client_ref, &cache, &config).await?; let token_lock: Arc> = Arc::new(RwLock::new(token)); start( token_lock.clone(), - jwks_client.clone(), client_ref.clone(), cache.clone(), config, @@ -65,7 +61,6 @@ impl Auth0 { async fn start( token_lock: Arc>, - jwks_client: JwksClient, client: Client, cache: Arc, config: Config,