[][src]Struct jwks_client::keyset::KeyStore

pub struct KeyStore { /* fields omitted */ }

Methods

impl KeyStore[src]

pub fn new() -> KeyStore[src]

pub async fn new_from<'_>(jkws_url: &'_ str) -> Result<KeyStore, Error>[src]

pub fn clear_keys(&mut self)[src]

pub fn key_set_url(&self) -> &str[src]

pub async fn load_keys_from<'_, '_>(
    &'_ mut self,
    url: &'_ str
) -> Result<(), Error>
[src]

pub async fn load_keys<'_>(&'_ mut self) -> Result<(), Error>[src]

pub fn key_by_id(&self, kid: &str) -> Option<&JwtKey>[src]

Fetch a key by key id (KID)

pub fn keys_len(&self) -> usize[src]

Number of keys in keystore

pub fn add_key(&mut self, key: &JwtKey)[src]

Manually add a key to the keystore

pub fn decode(&self, token: &str) -> Result<Jwt, Error>[src]

pub fn verify_time(&self, token: &str, time: SystemTime) -> Result<Jwt, Error>[src]

pub fn verify(&self, token: &str) -> Result<Jwt, Error>[src]

Verify a JWT token. If the token is valid, it is returned.

A token is considered valid if:

  • Is well formed
  • Has a kid field that matches a public signature `kid
  • Signature matches public key
  • It is not expired
  • The nbf is not set to before now

pub fn last_load_time(&self) -> Option<SystemTime>[src]

Time at which the keys were last refreshed

pub fn keys_expired(&self) -> Option<bool>[src]

True if the keys are expired and should be refreshed

None if keys do not have an expiration time

pub fn set_refresh_interval(&mut self, interval: f64)[src]

Specifies the interval (as a fraction) when the key store should refresh it's key.

The default is 0.5, meaning that keys should be refreshed when we are halfway through the expiration time (similar to DHCP).

This method does not update the refresh time. Call load_keys to force an update on the refresh time property.

pub fn refresh_interval(&self) -> f64[src]

Get the current fraction time to check for token refresh time.

pub fn load_time(&self) -> Option<SystemTime>[src]

The time at which the keys were loaded None if the keys were never loaded via load_keys or load_keys_from.

pub fn expire_time(&self) -> Option<SystemTime>[src]

Get the time at which the keys are considered expired

pub fn refresh_time(&self) -> Option<SystemTime>[src]

time at which keys should be refreshed.

pub fn should_refresh_time(&self, current_time: SystemTime) -> Option<bool>[src]

Returns Option<true> if keys should be refreshed based on the given current_time.

None is returned if the key store does not have a refresh time available. For example, the load_keys function was not called or the HTTP server did not provide a

pub fn should_refresh(&self) -> Option<bool>[src]

Returns Option<true> if keys should be refreshed based on the system time.

None is returned if the key store does not have a refresh time available. For example, the load_keys function was not called or the HTTP server did not provide a

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.