pub struct Validation {
pub leeway: u64,
pub validate_exp: bool,
pub validate_nbf: bool,
pub aud: Option<Vec<String>>,
pub iss: Option<Vec<String>>,
pub validate_signature: bool,
pub algs: Vec<Algorithm>,
}
Expand description
Defines the jwt validation parameters (with defaults simplifying configuration).
Fields§
§leeway: u64
Add some leeway (in seconds) to the exp
and nbf
validation to
account for clock skew.
Defaults to 60
.
validate_exp: bool
Whether to validate the exp
field.
Defaults to true
.
validate_nbf: bool
Whether to validate the nbf
field.
Defaults to false
.
aud: Option<Vec<String>>
If it contains a value, the validation will check that the aud
claim value is in the values provided.
Defaults to None
.
iss: Option<Vec<String>>
If it contains a value, the validation will check that the iss
claim value is in the values provided.
Defaults to None
.
validate_signature: bool
Whether to validate the JWT signature. Very insecure to turn that off!
Defaults to true.
algs: Vec<Algorithm>
Accepted algorithms
If empty anly the algorithms matching key will be authorized
Implementations§
Source§impl Validation
impl Validation
Sourcepub fn iss<T: ToString>(self, items: &[T]) -> Self
pub fn iss<T: ToString>(self, items: &[T]) -> Self
check that the iss
claim is a member of the values provided
Sourcepub fn aud<T: ToString>(self, items: &[T]) -> Self
pub fn aud<T: ToString>(self, items: &[T]) -> Self
check that the aud
claim is a member of the items provided
Sourcepub fn leeway(self, value: u64) -> Self
pub fn leeway(self, value: u64) -> Self
Add some leeway (in seconds) to the exp
and nbf
validation to
account for clock skew.
Sourcepub fn disable_validation(self) -> Self
pub fn disable_validation(self) -> Self
Whether to validate the JWT cryptographic signature Very insecure to turn that off, only do it if you know what you’re doing.