mas_oidc_client::types

Type Alias IdToken

source
pub type IdToken<'a> = Jwt<'a, HashMap<String, Value>>;
Expand description

An OpenID Connect ID Token.

Aliased Type§

struct IdToken<'a> { /* private fields */ }

Implementations

source§

impl<'a, T> Jwt<'a, T>

source

pub fn header(&self) -> &JsonWebSignatureHeader

Get the JWT header

source

pub fn payload(&self) -> &T

Get the JWT payload

source

pub fn into_owned(self) -> Jwt<'static, T>

source

pub fn verify<K, S>(&self, key: &K) -> Result<(), JwtVerificationError>
where K: Verifier<S>, S: SignatureEncoding,

Verify the signature of this JWT using the given key.

§Errors

Returns an error if the signature is invalid.

source

pub fn verify_with_shared_secret( &self, secret: Vec<u8>, ) -> Result<(), NoKeyWorked>

Verify the signature of this JWT using the given symmetric key.

§Errors

Returns an error if the signature is invalid or if the algorithm is not supported.

source

pub fn verify_with_jwks( &self, jwks: &JsonWebKeySet<JsonWebKeyPublicParameters>, ) -> Result<(), NoKeyWorked>

Verify the signature of this JWT using the given JWKS.

§Errors

Returns an error if the signature is invalid, if no key matches the constraints, or if the algorithm is not supported.

source

pub fn as_str(&'a self) -> &'a str

Get the raw JWT string as a borrowed str

source

pub fn into_string(self) -> String

Get the raw JWT string as an owned String

source

pub fn into_parts(self) -> (JsonWebSignatureHeader, T)

Split the JWT into its parts (header and payload).

source§

impl<T> Jwt<'static, T>

source

pub fn sign<K, S>( header: JsonWebSignatureHeader, payload: T, key: &K, ) -> Result<Jwt<'static, T>, JwtSignatureError>

Sign the given payload with the given key.

§Errors

Returns an error if the payload could not be serialized or if the key could not sign the payload.

source

pub fn sign_with_rng<R, K, S>( rng: &mut R, header: JsonWebSignatureHeader, payload: T, key: &K, ) -> Result<Jwt<'static, T>, JwtSignatureError>

Sign the given payload with the given key using the given RNG.

§Errors

Returns an error if the payload could not be serialized or if the key could not sign the payload.

Trait Implementations

source§

impl<'a, T> Clone for Jwt<'a, T>
where T: Clone,

source§

fn clone(&self) -> Jwt<'a, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Jwt<'_, T>
where T: Debug,

source§

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

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

impl<T> Display for Jwt<'_, T>

source§

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

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

impl<'a, T> PartialEq for Jwt<'a, T>
where T: PartialEq,

source§

fn eq(&self, other: &Jwt<'a, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<'a, T> TryFrom<&'a str> for Jwt<'a, T>

source§

type Error = JwtDecodeError

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

fn try_from( value: &'a str, ) -> Result<Jwt<'a, T>, <Jwt<'a, T> as TryFrom<&'a str>>::Error>

Performs the conversion.
source§

impl<'a, T> TryFrom<RawJwt<'a>> for Jwt<'a, T>

source§

type Error = JwtDecodeError

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

fn try_from( raw: RawJwt<'a>, ) -> Result<Jwt<'a, T>, <Jwt<'a, T> as TryFrom<RawJwt<'a>>>::Error>

Performs the conversion.
source§

impl<T> TryFrom<String> for Jwt<'static, T>

source§

type Error = JwtDecodeError

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

fn try_from( value: String, ) -> Result<Jwt<'static, T>, <Jwt<'static, T> as TryFrom<String>>::Error>

Performs the conversion.
source§

impl<'a, T> Eq for Jwt<'a, T>
where T: Eq,

source§

impl<'a, T> StructuralPartialEq for Jwt<'a, T>