Skip to main content

Module jwks

Module jwks 

Source
Expand description

JWKS (JSON Web Key Set) fetching and caching.

Provides both synchronous and asynchronous functions to fetch JWKS from a remote URL. Keys are cached globally in a OnceLock so that multiple token validations reuse the same key set without redundant HTTP calls.

§Example

use usso::jwks::init_jwks_sync;

init_jwks_sync("https://sso.usso.io/website/jwks.json").unwrap();
let keys = usso::jwks::get_jwk_keys().unwrap();
println!("Loaded {} keys", keys.keys.len());

Functions§

fetch_jwks_async
Fetch JWKS from the given URL (async) without caching.
fetch_jwks_sync
Fetch JWKS from the given URL (blocking) without caching.
get_jwk_keys
Get a reference to the globally cached JWKS key set.
init_jwks_async
Fetch JWKS from a URL and store it in the global cache (async).
init_jwks_sync
Fetch JWKS from a URL and store it in the global cache (blocking).