From 073508493c24c5eeb3db3a9b984d1eff98471926 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Mon, 12 Aug 2024 16:14:53 +0100 Subject: [PATCH] remove async_trait for FetchAuthRules --- proxy/src/auth/backend/jwt.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/proxy/src/auth/backend/jwt.rs b/proxy/src/auth/backend/jwt.rs index 9fa2da5e0f..2cfba4746f 100644 --- a/proxy/src/auth/backend/jwt.rs +++ b/proxy/src/auth/backend/jwt.rs @@ -1,8 +1,7 @@ -use std::{sync::Arc, time::Duration}; +use std::{future::Future, sync::Arc, time::Duration}; use anyhow::{bail, ensure, Context}; use arc_swap::ArcSwapOption; -use async_trait::async_trait; use bytes::Bytes; use dashmap::DashMap; use jose_jwk::crypto::KeyInfo; @@ -45,9 +44,8 @@ pub struct JWKCacheEntry { } /// How to get the JWT auth rules -#[async_trait] pub trait FetchAuthRules: Clone + Send + Sync + 'static { - async fn fetch_auth_rules(&self) -> anyhow::Result; + fn fetch_auth_rules(&self) -> impl Future> + Send; } #[derive(Clone)] @@ -56,7 +54,6 @@ struct FetchAuthFromCplane { endpoint: EndpointIdInt, } -#[async_trait] impl FetchAuthRules for FetchAuthFromCplane { async fn fetch_auth_rules(&self) -> anyhow::Result { Err(anyhow::anyhow!("not yet implemented")) @@ -388,7 +385,6 @@ mod tests { use std::{future::IntoFuture, net::SocketAddr, time::SystemTime}; - use async_trait::async_trait; use base64::URL_SAFE_NO_PAD; use bytes::Bytes; use http::Response; @@ -520,7 +516,6 @@ mod tests { #[derive(Clone)] struct Fetch(SocketAddr); - #[async_trait] impl FetchAuthRules for Fetch { async fn fetch_auth_rules(&self) -> anyhow::Result { Ok(AuthRules {