Skip to main content

JwtPayloadValidator

Struct JwtPayloadValidator 

Source
pub struct JwtPayloadValidator { /* private fields */ }
Expand description

Represents JWT payload validator.

Implementations§

Source§

impl JwtPayloadValidator

Source

pub fn new() -> Self

Return a new JwtPayloadValidator.

Source

pub fn set_base_time(&mut self, base_time: SystemTime)

Set a base time for time related claims (exp, nbf) validation.

§Arguments
  • base_time - a min time
Source

pub fn base_time(&self) -> Option<&SystemTime>

Return the base time for time related claims (exp, nbf) validation.

Source

pub fn set_min_issued_time(&mut self, min_issued_time: SystemTime)

Set a minimum time for issued at payload claim (iat) validation.

§Arguments
  • min_issued_time - a minimum time at which the JWT was issued.
Source

pub fn min_issued_time(&self) -> Option<&SystemTime>

Return the minimum time for issued at payload claim (iat).

Source

pub fn set_max_issued_time(&mut self, max_issued_time: SystemTime)

Set a maximum time for issued at payload claim (iat) validation.

§Arguments
  • max_issued_time - a maximum time at which the JWT was issued.
Source

pub fn max_issued_time(&self) -> Option<&SystemTime>

Return the maximum time for issued at payload claim (iat).

Source

pub fn set_issuer(&mut self, value: impl Into<String>)

Set a value for issuer payload claim (iss) validation.

§Arguments
  • value - a issuer
Source

pub fn issuer(&self) -> Option<&str>

Return the value for issuer payload claim (iss) validation.

Source

pub fn set_subject(&mut self, value: impl Into<String>)

Set a value for subject payload claim (sub) validation.

§Arguments
  • value - a subject
Source

pub fn subject(&self) -> Option<&str>

Return the value for subject payload claim (sub) validation.

Source

pub fn set_audience(&mut self, value: impl Into<String>)

Set a value for audience payload claim (aud) validation.

§Arguments
  • value - a audience
Source

pub fn audience(&self) -> Option<&str>

Return the value for audience payload claim (aud) validation.

Source

pub fn set_jwt_id(&mut self, value: impl Into<String>)

Set a value for JWT ID payload claim (jti) validation.

§Arguments
  • value - A JWT ID
Source

pub fn jwt_id(&self) -> Option<&str>

Return the value for JWT ID payload claim (jti) validation.

Source

pub fn set_claim(&mut self, key: &str, value: Value)

Set a value for payload claim of a specified key.

§Arguments
  • key - a key name of payload claim
  • value - a typed value of payload claim
Source

pub fn claim(&self, key: &str) -> Option<&Value>

Return the value for payload claim of a specified key.

§Arguments
  • key - a key name of payload claim
Source

pub fn validate(&self, payload: &JwtPayload) -> Result<(), JoseError>

Validate a decoded JWT payload.

§Arguments
  • payload - a decoded JWT payload.

Trait Implementations§

Source§

impl Debug for JwtPayloadValidator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for JwtPayloadValidator

Source§

impl PartialEq for JwtPayloadValidator

Source§

fn eq(&self, other: &JwtPayloadValidator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for JwtPayloadValidator

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.