pub struct JwksCache { /* private fields */ }Expand description
JWKS cache.
Implementations§
Source§impl JwksCache
impl JwksCache
Sourcepub const DEFAULT_MIN_FORCE_REFRESH_SECONDS: u64 = 30
pub const DEFAULT_MIN_FORCE_REFRESH_SECONDS: u64 = 30
Default minimum interval between force-refreshes triggered by kid misses.
Sourcepub fn new(fetcher: DocumentFetcherFn, refresh_seconds: u64) -> Self
pub fn new(fetcher: DocumentFetcherFn, refresh_seconds: u64) -> Self
Build a JWKS cache.
Sourcepub fn with_min_force_refresh_interval(self, interval: Duration) -> Self
pub fn with_min_force_refresh_interval(self, interval: Duration) -> Self
Override the minimum force-refresh interval (test hook).
Sourcepub fn document_cache(&self) -> Arc<DocumentCache> ⓘ
pub fn document_cache(&self) -> Arc<DocumentCache> ⓘ
Underlying DocumentCache (for aclose() plumbing).
Sourcepub async fn get(&self, force_refresh: bool) -> Result<Value, AuthplaneError>
pub async fn get(&self, force_refresh: bool) -> Result<Value, AuthplaneError>
Return the full JWKS document (forces a fetch if no cached value yet).
Sourcepub async fn get_key_by_kid(
&self,
kid: &str,
algorithm: Option<&str>,
) -> Result<Option<Value>, AuthplaneError>
pub async fn get_key_by_kid( &self, kid: &str, algorithm: Option<&str>, ) -> Result<Option<Value>, AuthplaneError>
Look up a JWK by kid, optionally restricting to a specific algorithm.
On a miss, the cache force-refreshes (rate-limited via
min_force_refresh_interval) and tries again, so a key rotation at
the same jwks_uri is followed without a caller-visible refresh.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for JwksCache
impl !UnwindSafe for JwksCache
impl Freeze for JwksCache
impl Send for JwksCache
impl Sync for JwksCache
impl Unpin for JwksCache
impl UnsafeUnpin for JwksCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more