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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.