pub struct JwksCache { /* private fields */ }Expand description
Fetches and caches JWKS keys by kid.
Implementations§
Source§impl JwksCache
impl JwksCache
Sourcepub fn new(uri: String) -> Result<Self, String>
pub fn new(uri: String) -> Result<Self, String>
Create a cache for uri (keys are loaded lazily on first lookup), whose
keys are refetched after DEFAULT_MAX_AGE.
§Errors
The HTTPS client cannot be built: the rustls crypto provider installed for the process supports neither TLS 1.2 nor TLS 1.3.
Sourcepub fn with_max_age(self, max_age: Duration) -> Self
pub fn with_max_age(self, max_age: Duration) -> Self
Refetch the keys once they are older than max_age. Refreshes stay
at least a minute apart, so a shorter age behaves as one minute.
Sourcepub async fn key_for(&self, kid: &str) -> Option<VerifyingKey>
pub async fn key_for(&self, kid: &str) -> Option<VerifyingKey>
Resolve the verifying key for kid, refreshing from the JWKS endpoint
once (throttled) if it is not cached or the cached keys are too old.
Auto Trait Implementations§
impl !Freeze for JwksCache
impl !RefUnwindSafe for JwksCache
impl !UnwindSafe 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request