pub struct TokenMetadata { /* private fields */ }
Expand description

JWT token information useful before signature/tag verification

Implementations§

source§

impl TokenMetadata

source

pub fn algorithm(&self) -> &str

The JWT algorithm for this token (“alg”) This information should not be trusted: it is unprotected and can be freely modified by a third party. Clients should ignore it and use the correct type of key directly.

source

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

The content type for this token (“cty”)

source

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

The key, or public key identifier for this token (“kid”)

source

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

The signature type for this token (“typ”)

source

pub fn critical(&self) -> Option<&[String]>

The set of raw critical properties for this token (“crit”)

source

pub fn certificate_chain(&self) -> Option<&[String]>

The certificate chain for this token (“x5c”) This information should not be trusted: it is unprotected and can be freely modified by a third party.

source

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

The key set URL for this token (“jku”) This information should not be trusted: it is unprotected and can be freely modified by a third party. At the bare minimum, you should check that the URL belongs to the domain you expect.

source

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

The public key for this token (“jwk”) This information should not be trusted: it is unprotected and can be freely modified by a third party. At the bare minimum, you should check that it’s in a set of public keys you already trust.

source

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

The certificate URL for this token (“x5u”) This information should not be trusted: it is unprotected and can be freely modified by a third party. At the bare minimum, you should check that the URL belongs to the domain you expect.

source

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

URLsafe-base64-encoded SHA1 hash of the X.509 certificate for this token (“x5t”) In practice, it can also be any string representing the public key. This information should not be trusted: it is unprotected and can be freely modified by a third party.

source

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

URLsafe-base64-encoded SHA256 hash of the X.509 certificate for this token (“x5t#256”) In practice, it can also be any string representing the public key. This information should not be trusted: it is unprotected and can be freely modified by a third party.

Trait Implementations§

source§

impl Clone for TokenMetadata

source§

fn clone(&self) -> TokenMetadata

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 Debug for TokenMetadata

source§

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

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

impl Default for TokenMetadata

source§

fn default() -> TokenMetadata

Returns the “default value” for a type. Read more

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<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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V