jwt library

Classes

Jwt
A JWT (json web token)
JwtHeader
A JWT header which contains the algorithm and token type.
JwtPayload
A JWT payload which contains data.

Enums

JwksFormat
The JWKS response format used by an auth provider's public key endpoint.

Properties

getOverride Future<Response> Function(Uri uri)?
Override for http.get. Used for testing purposes only.
getter/setter pair
publicKeyStores → TtlCache<String, PublicKeyStore>
A mapping of URLs to the public keys they contain. Example URL: https://login.microsoftonline.com/common/discovery/v2.0/keys
final

Functions

base64Padded(String value) String
Visible for testing only
extractFromRequestHeaders(Map<String, String> headers) Jwt
Extracts a JWT from the Authorization header of the request. Throws a JwtExtractionFailure if the header is missing or the token is malformed. Does NOT verify the JWT.
verify(String encodedJwt, {required String issuer, required Set<String> audience, required String publicKeysUrl, required JwksFormat jwksFormat}) Future<Jwt>
Verify the encoded encodedJwt.

Exceptions / Errors

JwtExtractionFailure
An exception thrown during JWT extraction.
JwtVerificationFailure
An exception thrown during JWT verification.