Skip to main content

JwksStore

Trait JwksStore 

Source
pub trait JwksStore: MaybeSendSync {
    // Required methods
    fn load<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<StoredJwks>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
        jwks: &'life2 StoredJwks,
        ttl: Duration,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

A copy of the fetched set somewhere other processes can read it.

For a host whose processes come and go faster than the set changes: a Cloudflare Worker keeps it in KV, so that an isolate starting cold reads what another fetched a minute ago instead of asking the identity provider again. A stored copy is used only while it is fresh, and never to answer an unknown kid – that question is only answered by the provider.

Required Methods§

Source

fn load<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<StoredJwks>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The stored copy for url, if there is one.

Source

fn save<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 str, jwks: &'life2 StoredJwks, ttl: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Store jwks for url. It may be dropped once ttl has passed. Failing is not an error worth more than a log line.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§