Struct mas_handlers::MetadataCache
source · pub struct MetadataCache { /* private fields */ }
Expand description
A simple OIDC metadata cache
It never evicts entries, does not cache failures and has no locking. It can also be refreshed in the background, and warmed up on startup. It is good enough for our use case.
Implementations§
source§impl MetadataCache
impl MetadataCache
pub fn new() -> Self
sourcepub async fn warm_up_and_run<R: RepositoryAccess>(
&self,
http_service: HttpService,
interval: Duration,
repository: &mut R,
) -> Result<JoinHandle<()>, R::Error>
pub async fn warm_up_and_run<R: RepositoryAccess>( &self, http_service: HttpService, interval: Duration, repository: &mut R, ) -> Result<JoinHandle<()>, R::Error>
Warm up the cache by fetching all the known providers from the database and inserting them into the cache.
This spawns a background task that will refresh the cache at the given interval.
sourcepub async fn get(
&self,
http_service: &HttpService,
issuer: &str,
verify: bool,
) -> Result<Arc<VerifiedProviderMetadata>, DiscoveryError>
pub async fn get( &self, http_service: &HttpService, issuer: &str, verify: bool, ) -> Result<Arc<VerifiedProviderMetadata>, DiscoveryError>
Get the metadata for the given issuer.
Trait Implementations§
source§impl Clone for MetadataCache
impl Clone for MetadataCache
source§fn clone(&self) -> MetadataCache
fn clone(&self) -> MetadataCache
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MetadataCache
impl Debug for MetadataCache
source§impl Default for MetadataCache
impl Default for MetadataCache
source§fn default() -> MetadataCache
fn default() -> MetadataCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MetadataCache
impl !RefUnwindSafe for MetadataCache
impl Send for MetadataCache
impl Sync for MetadataCache
impl Unpin for MetadataCache
impl !UnwindSafe 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
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more