Struct josekit::jws::JwsHeader

source ·
pub struct JwsHeader { /* private fields */ }
Expand description

Represent JWS header claims

Implementations§

source§

impl JwsHeader

source

pub fn new() -> Self

Return a JwsHeader instance.

source

pub fn from_bytes(value: &[u8]) -> Result<Self, JoseError>

Return a new header instance from json style header.

§Arguments
  • value - The json style header claims
source

pub fn from_map(map: impl Into<Map<String, Value>>) -> Result<Self, JoseError>

Return a new header instance from map.

§Arguments
  • map - JWT header claims.
source

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

Set a value for algorithm header claim (alg).

§Arguments
  • value - a algorithm
source

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

Return the value for algorithm header claim (alg).

source

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

Set a value for JWK set URL header claim (jku).

§Arguments
  • value - a JWK set URL
source

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

Return the value for JWK set URL header claim (jku).

source

pub fn set_jwk(&mut self, value: Jwk)

Set a value for JWK header claim (jwk).

§Arguments
  • value - a JWK
source

pub fn jwk(&self) -> Option<Jwk>

Return the value for JWK header claim (jwk).

source

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

Set a value for X.509 URL header claim (x5u).

§Arguments
  • value - a X.509 URL
source

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

Return a value for a X.509 URL header claim (x5u).

source

pub fn set_x509_certificate_chain(&mut self, values: &Vec<impl AsRef<[u8]>>)

Set values for X.509 certificate chain header claim (x5c).

§Arguments
  • values - X.509 certificate chain
source

pub fn x509_certificate_chain(&self) -> Option<Vec<Vec<u8>>>

Return values for a X.509 certificate chain header claim (x5c).

source

pub fn set_x509_certificate_sha1_thumbprint(&mut self, value: impl AsRef<[u8]>)

Set a value for X.509 certificate SHA-1 thumbprint header claim (x5t).

§Arguments
  • value - A X.509 certificate SHA-1 thumbprint
source

pub fn x509_certificate_sha1_thumbprint(&self) -> Option<Vec<u8>>

Return the value for X.509 certificate SHA-1 thumbprint header claim (x5t).

source

pub fn set_x509_certificate_sha256_thumbprint( &mut self, value: impl AsRef<[u8]> )

Set a value for a x509 certificate SHA-256 thumbprint header claim (x5t#S256).

§Arguments
  • value - A x509 certificate SHA-256 thumbprint
source

pub fn x509_certificate_sha256_thumbprint(&self) -> Option<Vec<u8>>

Return the value for X.509 certificate SHA-256 thumbprint header claim (x5t#S256).

source

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

Set a value for key ID header claim (kid).

§Arguments
  • value - a key ID
source

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

Return the value for key ID header claim (kid).

source

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

Set a value for token type header claim (typ).

§Arguments
  • value - a token type (e.g. “JWT”)
source

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

Return the value for token type header claim (typ).

source

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

Set a value for content type header claim (cty).

§Arguments
  • value - a content type (e.g. “JWT”)
source

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

Return the value for content type header claim (cty).

source

pub fn set_critical(&mut self, values: &Vec<impl AsRef<str>>)

Set values for critical header claim (crit).

§Arguments
  • values - critical claim names
source

pub fn critical(&self) -> Option<Vec<&str>>

Return values for critical header claim (crit).

source

pub fn set_base64url_encode_payload(&mut self, value: bool)

Set a value for base64url-encode payload header claim (b64).

§Arguments
  • value - is base64url-encode payload
source

pub fn base64url_encode_payload(&self) -> Option<bool>

Return the value for base64url-encode payload header claim (b64).

source

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

Set a value for url header claim (url).

§Arguments
  • value - a url
source

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

Return the value for url header claim (url).

source

pub fn set_nonce(&mut self, value: impl AsRef<[u8]>)

Set a value for a nonce header claim (nonce).

§Arguments
  • value - A nonce
source

pub fn nonce(&self) -> Option<Vec<u8>>

Return the value for nonce header claim (nonce).

source

pub fn set_claim( &mut self, key: &str, value: Option<Value> ) -> Result<(), JoseError>

Set a value for header claim of a specified key.

§Arguments
  • key - a key name of header claim
  • value - a typed value of header claim
source

pub fn claims_set(&self) -> &Map<String, Value>

Return values for header claims set

source

pub fn into_map(self) -> Map<String, Value>

Convert into map

Trait Implementations§

source§

impl AsRef<Map<String, Value>> for JwsHeader

source§

fn as_ref(&self) -> &Map<String, Value>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for JwsHeader

source§

fn clone(&self) -> JwsHeader

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 JwsHeader

source§

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

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

impl Deref for JwsHeader

§

type Target = dyn JoseHeader

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Display for JwsHeader

source§

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

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

impl Into<Map<String, Value>> for JwsHeader

source§

fn into(self) -> Map<String, Value>

Converts this type into the (usually inferred) input type.
source§

impl JoseHeader for JwsHeader

source§

fn len(&self) -> usize

Return claim count.
source§

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

Return the value for header claim of a specified key. Read more
source§

fn box_clone(&self) -> Box<dyn JoseHeader>

source§

impl PartialEq for JwsHeader

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for JwsHeader

source§

impl StructuralPartialEq for JwsHeader

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> 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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.