Struct jwt_authorizer::validation::Validation
source · 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: u64Add some leeway (in seconds) to the exp and nbf validation to
account for clock skew.
Defaults to 60.
validate_exp: boolWhether to validate the exp field.
Defaults to true.
validate_nbf: boolWhether 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: boolWhether 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.