Expand description
JWT authentication for Postrust.
Provides JWT token validation and role extraction for PostgreSQL RLS.
Re-exports§
pub use hasura::HasuraAuthConfig;pub use hasura::HasuraIdentity;pub use hasura::SecretOutcome;pub use hasura::TokenRole;pub use jwks::Jwks;
Modules§
- hasura
- Hasura’s authentication contract.
- jwks
- Keys fetched from a JWKS URL (
PGRST_JWT_JWKS_URL), and kept current.
Structs§
- Auth
Result - Authentication result containing role and claims.
- Cache
Stats - How many lookups a
JwtCachehas answered, since it was made. - Claims
- Parsed JWT claims for use in requests.
- JwtCache
- A bounded cache of validated tokens.
- JwtConfig
- JWT configuration.
- JwtKeys
- The verification keys a server holds, shared and replaceable.
- KeySet
- A parsed set of verification keys.
Enums§
- Cache
Outcome - Whether a lookup in a
JwtCachewas answered from it. - Claim
Fault - What was wrong with a token’s claims.
- JwtError
- JWT validation error.
- JwtKey
Error - A JWT secret that cannot be turned into keys.
Functions§
- authenticate
- Extract and validate JWT from Authorization header.
- ensure_
keys - Make sure the keys the request’s token needs are loaded, before the
synchronous
authenticate(orJwtCache::authenticate) runs. - validate_
token - Validate a JWT token and extract claims.