pub fn validate_iat(
        &self,
        validation: Validation<(Duration, TemporalOptions)>,
    ) -> Result<(), ValidationError> {
        match validation {
            Validation::Ignored => Ok(()),
            Validation::Validate((max_age, temporal_options)) => {
                let now = temporal_options.now.unwrap_or_else(Utc::now);

                match self.issued_at {
                    Some(Timestamp(iat)) if iat - now > temporal_options.epsilon => {
                        Err(ValidationError::NotYetValid(iat - now))
                    }
                    Some(Timestamp(iat)) if now - iat > max_age - temporal_options.epsilon => {
                        Err(ValidationError::TooOld(now - iat - max_age))
                    }
                    _ => Ok(()),
                }
            }
        }
    }
/// Validates that if the token has an `iat` claim, it is not in the future and not older than the Duration
Validates that if the token has an `iat` claim, it is not in the future and not older than the Duration
Validates that if the token has an ` iat ` claim it is not in the future and not older than the Duration
pub fn validate_iat(
        &self,
        validation: Validation<(Duration, TemporalOptions)>,
    ) -> Result<(), ValidationError> {
        match validation {
            Validation::Ignored => Ok(()),
            Validation::Validate((max_age, temporal_options)) => {
                let now = temporal_options.now.unwrap_or_else(Utc::now);
                match self.issued_at {
                    Some(Timestamp(iat)) if iat - now > temporal_options.epsilon => {
                        Err(ValidationError::NotYetValid(iat - now))
                    }
                    Some(Timestamp(iat)) if now - iat > max_age - temporal_options.epsilon => {
                        Err(ValidationError::TooOld(now - iat - max_age))
                    }
                    _ => Ok(()),
                }
            }
        }
    }
pub fn validate_iat ( & self , validation : Validation < ( Duration , TemporalOptions ) > , ) -> Result < ( ) , ValidationError > { match validation { Validation :: Ignored => Ok ( ( ) ) , Validation :: Validate ( ( max_age , temporal_options ) ) => { let now = temporal_options . now . unwrap_or_else ( Utc :: now ) ; match self . issued_at { Some ( Timestamp ( iat ) ) if iat - now > temporal_options . epsilon => { Err ( ValidationError :: NotYetValid ( iat - now ) ) } Some ( Timestamp ( iat ) ) if now - iat > max_age - temporal_options . epsilon => { Err ( ValidationError :: TooOld ( now - iat - max_age ) ) } _ => Ok ( ( ) ) , } } } }
Validates that if the token has an `iat` claim, it is not in the future and not older than the Duration
Validates that if the token has an ` iat ` claim it is not in the future and not older than the Duration
&self
validation
Validation<(Duration, TemporalOptions)>
&self
validation
Validation<(Duration, TemporalOptions)>