pub struct JwksCache { /* private fields */ }Expand description
Fetches and caches Google’s public keys used to verify Firebase ID tokens.
Concurrent lookups that miss the cache at the same time (e.g. a burst of
verify_id_token calls right after Google rotates its signing keys) share
a single in-flight refresh rather than each issuing their own HTTP
request: an internal lock is held for the duration of the fetch, so
callers that arrive while a refresh is already underway simply wait for
it to finish and then re-check the now-populated cache.
Implementations§
Source§impl JwksCache
impl JwksCache
Sourcepub fn new(http: HttpClient) -> Self
pub fn new(http: HttpClient) -> Self
Creates a cache pointed at the standard securetoken JWKS endpoint.
Sourcepub async fn public_key(
&self,
kid: &str,
) -> Result<(String, String), TokenVerificationError>
pub async fn public_key( &self, kid: &str, ) -> Result<(String, String), TokenVerificationError>
Returns the RSA public key components (n, e, base64url-encoded)
for the given key id, fetching or refreshing the cache as needed.
Auto Trait Implementations§
impl !Freeze for JwksCache
impl !RefUnwindSafe for JwksCache
impl !UnwindSafe for JwksCache
impl Send for JwksCache
impl Sync for JwksCache
impl Unpin for JwksCache
impl UnsafeUnpin for JwksCache
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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