pub struct TokenValidationConfig {
pub iss_validation: bool,
pub aud_validation: bool,
pub sub_validation: bool,
pub jti_validation: bool,
pub iat_validation: bool,
pub exp_validation: bool,
pub nbf_validation: bool,
}
Expand description
Validation options related to JSON Web Tokens (JWT).
This struct provides the configuration for validating common JWT claims (iss
,
aud
, sub
, jti
, exp
, nbf
) across different types of JWTs.
The default configuration for Access Tokens, ID Tokens, and Userinfo Tokens can be easily instantiated via the provided methods.
Fields§
§iss_validation: bool
Requires the iss
claim to be present in the JWT and the scheme
must be https
.
aud_validation: bool
Requires the aud
claim to be present in the JWT.
sub_validation: bool
Requires the sub
claim to be present in the JWT.
jti_validation: bool
Requires the jti
claim to be present in the JWT.
iat_validation: bool
Requires the iat
claim to be present in the JWT.
exp_validation: bool
Requires the exp
claim to be present in the JWT and the current
timestamp isn’t past the specified timestamp in the token.
nbf_validation: bool
Requires the nbf
claim to be present in the JWT.
Implementations§
source§impl TokenValidationConfig
impl TokenValidationConfig
sourcepub fn required_claims(&self) -> HashSet<Box<str>>
pub fn required_claims(&self) -> HashSet<Box<str>>
Collects all the required claims into a HashSet.
sourcepub fn access_token() -> Self
pub fn access_token() -> Self
Returns a default configuration for validating Access Tokens.
This configuration requires the following:
iss
(Issuer)jti
(JWT ID)exp
(Expiration)
sourcepub fn id_token() -> Self
pub fn id_token() -> Self
Returns a default configuration for validating ID Tokens.
This configuration requires the following:
iss
(Issuer)aud
(Audience)sub
(Subject)exp
(Expiration)
sourcepub fn userinfo_token() -> Self
pub fn userinfo_token() -> Self
Returns a default configuration for validating Userinfo Tokens.
This configuration requires the following:
iss
(issuer)aud
(audience)sub
(subject)exp
(expiration)
Trait Implementations§
source§impl Debug for TokenValidationConfig
impl Debug for TokenValidationConfig
source§impl Default for TokenValidationConfig
impl Default for TokenValidationConfig
source§fn default() -> TokenValidationConfig
fn default() -> TokenValidationConfig
source§impl PartialEq for TokenValidationConfig
impl PartialEq for TokenValidationConfig
impl StructuralPartialEq for TokenValidationConfig
Auto Trait Implementations§
impl Freeze for TokenValidationConfig
impl RefUnwindSafe for TokenValidationConfig
impl Send for TokenValidationConfig
impl Sync for TokenValidationConfig
impl Unpin for TokenValidationConfig
impl UnwindSafe for TokenValidationConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more