Skip to content

Commit

Permalink
Remove jwks_client dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
MaeIsBad committed Aug 22, 2024
1 parent 8354838 commit b303cef
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand All @@ -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"]}
Expand Down
2 changes: 0 additions & 2 deletions src/auth0/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")]
Expand Down
5 changes: 0 additions & 5 deletions src/auth0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<RwLock<Token>> = Arc::new(RwLock::new(token));

start(
token_lock.clone(),
jwks_client.clone(),
client_ref.clone(),
cache.clone(),
config,
Expand All @@ -65,7 +61,6 @@ impl Auth0 {

async fn start(
token_lock: Arc<RwLock<Token>>,
jwks_client: JwksClient<WebSource>,
client: Client,
cache: Arc<dyn Cache>,
config: Config,
Expand Down

0 comments on commit b303cef

Please sign in to comment.