actix_web_security/authentication/scheme/bearer/jwt/
default_jwt.rs

1//! A JWT is characterized through a set of `Claims`. There are mandatory claims defined for JWTs and optional ones.
2//! This module provides a default implementation with common claims (iss, sub, aud, exp, nbf, iat, jti).
3use serde::{Deserialize, Serialize};
4
5use crate::authentication::scheme::bearer::jwt::token::Claims;
6
7/// A default implementation that can be used for JWT based authentication with commonly used claims.
8#[derive(Clone, Debug, Serialize, Deserialize)]
9pub struct DefaultJwt {
10    /// The URL of the identity provider
11    pub iss: Option<String>,
12    /// The principal identifier
13    pub sub: Option<String>,
14    /// The recipients the claim is for
15    pub aud: Option<String>,
16    /// The expiration date of the token
17    pub exp: Option<usize>,
18    /// The time the token must not be used before
19    pub nbf: Option<usize>,
20    /// The time the token was issues
21    pub iat: Option<usize>,
22    /// Unique identifier of the token
23    pub jti: Option<String>,
24}
25
26impl Claims for DefaultJwt {}