pub struct JwkProvider { /* private fields */ }Expand description
JWK provider for fetching and caching JWKs
Implementations§
Source§impl JwkProvider
impl JwkProvider
Sourcepub fn new(
region: &str,
user_pool_id: &str,
cache_duration: Duration,
) -> Result<Self, JwtError>
pub fn new( region: &str, user_pool_id: &str, cache_duration: Duration, ) -> Result<Self, JwtError>
Create a new JWK provider
This constructor creates a JwkProvider without prefetching keys. Keys will be fetched on the first request.
Sourcepub fn from_jwks_url(
jwks_url: &str,
issuer: &str,
cache_duration: Duration,
) -> Result<Self, JwtError>
pub fn from_jwks_url( jwks_url: &str, issuer: &str, cache_duration: Duration, ) -> Result<Self, JwtError>
Create a new JWK provider from a JWKS URL (for OIDC providers)
This constructor creates a JwkProvider for generic OIDC providers. Keys will be fetched on the first request.
§Arguments
jwks_url- The full URL to the JWKS endpoint (e.g., “https://example.com/.well-known/jwks.json”)issuer- The issuer URL (e.g., “https://example.com”)cache_duration- How long to cache keys before refreshing
Sourcepub fn get_issuer(&self) -> &str
pub fn get_issuer(&self) -> &str
Get the issuer URL
Sourcepub async fn prefetch_keys(&self) -> Result<(), JwtError>
pub async fn prefetch_keys(&self) -> Result<(), JwtError>
Prefetch JWKs from the Cognito user pool This method should be called when the system starts to ensure JWKs are available
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for JwkProvider
impl !RefUnwindSafe for JwkProvider
impl Send for JwkProvider
impl Sync for JwkProvider
impl Unpin for JwkProvider
impl !UnwindSafe for JwkProvider
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