[][src]Struct aliri_jose::jwt::Claims

pub struct Claims<P = Empty> { /* fields omitted */ }

Common claims used in JWTs

Implementations

impl Claims[src]

pub const fn new() -> Self[src]

Constructs a new, empty payload

impl<C: Serialize> Claims<C>[src]

pub fn sign<H: Serialize + HasAlgorithm>(
    &self,
    jwk: &Jwk,
    headers: &H
) -> Result<Jwt, JwtSigningError>
[src]

Produces a signed JWT with the given header and claims

impl<P> Claims<P>[src]

pub fn with_audience(self, aud: impl Into<Audience>) -> Self[src]

Sets the aud claim for the JWT

pub fn with_audiences(self, aud: impl Into<Audiences>) -> Self[src]

Sets the aud claim for the JWT, where multiple audiences are allowed

pub fn with_issuer(self, iss: impl Into<Issuer>) -> Self[src]

Sets the iss claim for the JWT

pub fn with_subject(self, sub: impl Into<Subject>) -> Self[src]

Sets the sub claim for the JWT

pub fn with_future_expiration(self, secs: u64) -> Self[src]

Sets the exp claim for the JWT using the system clock

pub fn with_future_expiration_from_clock<C: Clock>(
    self,
    secs: u64,
    clock: &C
) -> Self
[src]

Sets the exp claim for the JWT using the specified clock

pub fn with_expiration(self, time: UnixTime) -> Self[src]

Sets the exp claim for the JWT

pub fn with_not_before(self, time: UnixTime) -> Self[src]

Sets the nbf claim for the JWT

pub fn with_payload<Q>(self, payload: Q) -> Claims<Q>[src]

Adds a custom payload of claims to the JWT

pub fn payload(&self) -> &P[src]

Borrows the custom claims attached to the JWT

pub fn take_payload(self) -> P[src]

Moves the custom claims out

Trait Implementations

impl<P: Clone> Clone for Claims<P>[src]

impl<P> CoreClaims for Claims<P>[src]

impl<P: Debug> Debug for Claims<P>[src]

impl<'de, P> Deserialize<'de> for Claims<P> where
    P: Deserialize<'de>, 
[src]

impl<P: Eq> Eq for Claims<P>[src]

impl<P: PartialEq> PartialEq<Claims<P>> for Claims<P>[src]

impl<P> Serialize for Claims<P> where
    P: Serialize
[src]

impl<P> StructuralEq for Claims<P>[src]

impl<P> StructuralPartialEq for Claims<P>[src]

Auto Trait Implementations

impl<P> RefUnwindSafe for Claims<P> where
    P: RefUnwindSafe

impl<P> Send for Claims<P> where
    P: Send

impl<P> Sync for Claims<P> where
    P: Sync

impl<P> Unpin for Claims<P> where
    P: Unpin

impl<P> UnwindSafe for Claims<P> where
    P: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.