pub struct MetadataCache { /* private fields */ }Expand description
AS metadata cache.
Implementations§
Source§impl MetadataCache
impl MetadataCache
Sourcepub fn new(
fetcher: DocumentFetcherFn,
expected_issuer: impl Into<String>,
fetch_settings: FetchSettings,
refresh_seconds: u64,
on_change: Option<MetadataChangeCallback>,
) -> Self
pub fn new( fetcher: DocumentFetcherFn, expected_issuer: impl Into<String>, fetch_settings: FetchSettings, refresh_seconds: u64, on_change: Option<MetadataChangeCallback>, ) -> Self
Create a new metadata cache.
fetcher MUST GET the AS metadata document. expected_issuer is
the issuer the application configured; the discovered document
is rejected if its issuer field does not match exactly (RFC 8414).
Sourcepub fn document_cache(&self) -> Arc<DocumentCache> ⓘ
pub fn document_cache(&self) -> Arc<DocumentCache> ⓘ
Underlying DocumentCache (for aclose() plumbing).
Sourcepub async fn get_metadata(&self) -> Result<Value, AuthplaneError>
pub async fn get_metadata(&self) -> Result<Value, AuthplaneError>
Return the cached metadata document, refreshing if expired.
Sourcepub async fn refresh(&self) -> Result<Value, AuthplaneError>
pub async fn refresh(&self) -> Result<Value, AuthplaneError>
Force-refresh and return the metadata document.
Sourcepub async fn endpoint(&self, key: &str) -> Result<String, AuthplaneError>
pub async fn endpoint(&self, key: &str) -> Result<String, AuthplaneError>
Read a specific endpoint URL out of the cached metadata.
Sourcepub async fn get_jwks_uri(&self) -> Result<String, AuthplaneError>
pub async fn get_jwks_uri(&self) -> Result<String, AuthplaneError>
Convenience accessor for jwks_uri. The URL is validated through
the fetch settings (HTTPS-only, SSRF, …).
Sourcepub async fn get_token_endpoint(&self) -> Result<String, AuthplaneError>
pub async fn get_token_endpoint(&self) -> Result<String, AuthplaneError>
Convenience accessor for token_endpoint.
Sourcepub async fn get_introspection_endpoint(&self) -> Result<String, AuthplaneError>
pub async fn get_introspection_endpoint(&self) -> Result<String, AuthplaneError>
Convenience accessor for introspection_endpoint.
Sourcepub async fn get_revocation_endpoint(&self) -> Result<String, AuthplaneError>
pub async fn get_revocation_endpoint(&self) -> Result<String, AuthplaneError>
Convenience accessor for revocation_endpoint.
Trait Implementations§
Source§impl Clone for MetadataCache
impl Clone for MetadataCache
Auto Trait Implementations§
impl !RefUnwindSafe for MetadataCache
impl !UnwindSafe for MetadataCache
impl Freeze for MetadataCache
impl Send for MetadataCache
impl Sync for MetadataCache
impl Unpin for MetadataCache
impl UnsafeUnpin for MetadataCache
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