Skip to main content

Module verify

Module verify 

Source
Expand description

Verifying fastauth JWTs against a JWKS, for resource servers that don’t run fastauth.

Fetch {base_url}{base_path}/jwks (http://localhost:3000/api/auth/jwks), build a JwksVerifier from it, and check each request’s token with it. When VerifyError::UnknownKey comes back, the auth server may have rotated to a key you haven’t seen: fetch the JWKS again and retry once, but at most once per cool-down (30 s or more, like jose’s createRemoteJWKSet). UnknownKey is decided from the token’s header before any signature check, so anyone can produce it with a made-up kid; refetching on every one lets any client make your server fetch the JWKS once per request.

Structs§

JwksVerifier
Checks a token’s signature against a JWKS, then its exp, nbf, iss and aud. Tokens need exp, sub, iss and aud, which every token fastauth signs has.

Enums§

VerifyError
Why a token didn’t verify.