Expand description
Copyright (C) 2022 Federico Vitale
Implements a library to iteract and decode JWTs generated from auth0
Usage Example (via Axum)
with
axum
andclaims
features enabled
#[cfg(all(feature = "claims", feature = "claims"))]
use auth0_jwt::claims::Claims;
#[cfg(all(feature = "claims", feature = "claims"))]
use axum::response::IntoResponse;
struct ClaimsContent {
exp: usize,
iat: usize,
}
// Using the `Claims` struct lets you decode automatically the value into a struct.
#[cfg(all(feature = "claims", feature = "claims"))]
async fn handler(Claims(claims): Claims<ClaimsContent>) -> impl IntoResponse {
// your claims
println!("Exp: {}, Iat: {}", claims.exp, claims.iat);
}
Modules
Includes feature flagged adapters for various
http servers such as
axum
, actix-web
, rocket
etcStructs
Enums
Possible token claim validations. This enumeration only covers
common use-cases, for other types of validations the user is
encouraged to inspect the claim set manually.
Functions
Returns the claims stored into the given JWT