pub struct RemoteJwksDecoder { /* private fields */ }
Expand description
Remote JWKS decoder. It fetches the JWKS from the given URL and caches it for the given duration. It uses the cached JWKS to decode the JWT tokens.
Implementations§
Source§impl RemoteJwksDecoder
impl RemoteJwksDecoder
Sourcepub fn new(jwks_url: String) -> Result<Self, Error>
pub fn new(jwks_url: String) -> Result<Self, Error>
Creates a new RemoteJwksDecoder
with the given JWKS URL.
Sourcepub fn builder() -> RemoteJwksDecoderBuilder
pub fn builder() -> RemoteJwksDecoderBuilder
Creates a new RemoteJwksDecoderBuilder
.
This is a convenience method to create a builder for the decoder.
Sourcepub async fn refresh_keys_periodically(&self)
pub async fn refresh_keys_periodically(&self)
Refreshes the JWKS cache periodically.
It runs in a loop and never returns, so it should be run in a separate tokio task
using tokio::spawn
. If the JWKS refresh fails after multiple attemps,
it logs the error and continues. The decoder will use the stale keys until the next refresh
succeeds or the universe ends, whichever comes first.
Trait Implementations§
Source§impl Clone for RemoteJwksDecoder
impl Clone for RemoteJwksDecoder
Source§fn clone(&self) -> RemoteJwksDecoder
fn clone(&self) -> RemoteJwksDecoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> JwtDecoder<T> for RemoteJwksDecoderwhere
T: for<'de> DeserializeOwned,
impl<T> JwtDecoder<T> for RemoteJwksDecoderwhere
T: for<'de> DeserializeOwned,
Auto Trait Implementations§
impl Freeze for RemoteJwksDecoder
impl !RefUnwindSafe for RemoteJwksDecoder
impl Send for RemoteJwksDecoder
impl Sync for RemoteJwksDecoder
impl Unpin for RemoteJwksDecoder
impl !UnwindSafe for RemoteJwksDecoder
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