Skip to main content

Crate postrust_auth

Crate postrust_auth 

Source
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§

AuthResult
Authentication result containing role and claims.
CacheStats
How many lookups a JwtCache has 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§

CacheOutcome
Whether a lookup in a JwtCache was answered from it.
ClaimFault
What was wrong with a token’s claims.
JwtError
JWT validation error.
JwtKeyError
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 (or JwtCache::authenticate) runs.
validate_token
Validate a JWT token and extract claims.