Struct josekit::jwt::JwtContext
source · pub struct JwtContext { /* private fields */ }
Implementations§
source§impl JwtContext
impl JwtContext
pub fn new() -> Self
sourcepub fn is_acceptable_critical(&self, name: &str) -> bool
pub fn is_acceptable_critical(&self, name: &str) -> bool
sourcepub fn add_acceptable_critical(&mut self, name: &str)
pub fn add_acceptable_critical(&mut self, name: &str)
Add a acceptable critical header claim name
§Arguments
name
- a acceptable critical header claim name
sourcepub fn remove_acceptable_critical(&mut self, name: &str)
pub fn remove_acceptable_critical(&mut self, name: &str)
Remove a acceptable critical header claim name
§Arguments
name
- a acceptable critical header claim name
sourcepub fn encode_unsecured(
&self,
payload: &JwtPayload,
header: &JwsHeader
) -> Result<String, JoseError>
pub fn encode_unsecured( &self, payload: &JwtPayload, header: &JwsHeader ) -> Result<String, JoseError>
Return the string repsentation of the JWT with a “none” algorithm.
§Arguments
payload
- The payload data.header
- The JWT heaser claims.
sourcepub fn encode_with_signer(
&self,
payload: &JwtPayload,
header: &JwsHeader,
signer: &dyn JwsSigner
) -> Result<String, JoseError>
pub fn encode_with_signer( &self, payload: &JwtPayload, header: &JwsHeader, signer: &dyn JwsSigner ) -> Result<String, JoseError>
Return the string repsentation of the JWT with the siginig algorithm.
§Arguments
payload
- The payload data.header
- The JWS heaser claims.signer
- a signer object.
sourcepub fn encode_with_encrypter(
&self,
payload: &JwtPayload,
header: &JweHeader,
encrypter: &dyn JweEncrypter
) -> Result<String, JoseError>
pub fn encode_with_encrypter( &self, payload: &JwtPayload, header: &JweHeader, encrypter: &dyn JweEncrypter ) -> Result<String, JoseError>
Return the string repsentation of the JWT with the encrypting algorithm.
§Arguments
payload
- The payload data.header
- The JWE heaser claims.encrypter
- a encrypter object.
sourcepub fn decode_header(
&self,
input: impl AsRef<[u8]>
) -> Result<Box<dyn JoseHeader>, JoseError>
pub fn decode_header( &self, input: impl AsRef<[u8]> ) -> Result<Box<dyn JoseHeader>, JoseError>
sourcepub fn decode_unsecured(
&self,
input: impl AsRef<[u8]>
) -> Result<(JwtPayload, JwsHeader), JoseError>
pub fn decode_unsecured( &self, input: impl AsRef<[u8]> ) -> Result<(JwtPayload, JwsHeader), JoseError>
Return the JWT object decoded with the “none” algorithm.
§Arguments
input
- a JWT string representation.
sourcepub fn decode_with_verifier(
&self,
input: impl AsRef<[u8]>,
verifier: &dyn JwsVerifier
) -> Result<(JwtPayload, JwsHeader), JoseError>
pub fn decode_with_verifier( &self, input: impl AsRef<[u8]>, verifier: &dyn JwsVerifier ) -> Result<(JwtPayload, JwsHeader), JoseError>
Return the JWT object decoded by the selected verifier.
§Arguments
verifier
- a verifier of the signing algorithm.input
- a JWT string representation.
sourcepub fn decode_with_verifier_selector<'a, F>(
&self,
input: impl AsRef<[u8]>,
selector: F
) -> Result<(JwtPayload, JwsHeader), JoseError>
pub fn decode_with_verifier_selector<'a, F>( &self, input: impl AsRef<[u8]>, selector: F ) -> Result<(JwtPayload, JwsHeader), JoseError>
Return the JWT object decoded with a selected verifying algorithm.
§Arguments
input
- a JWT string representation.selector
- a function for selecting the verifying algorithm.
sourcepub fn decode_with_verifier_in_jwk_set<F>(
&self,
input: impl AsRef<[u8]>,
jwk_set: &JwkSet,
selector: F
) -> Result<(JwtPayload, JwsHeader), JoseError>
pub fn decode_with_verifier_in_jwk_set<F>( &self, input: impl AsRef<[u8]>, jwk_set: &JwkSet, selector: F ) -> Result<(JwtPayload, JwsHeader), JoseError>
Return the JWT object decoded by using a JWK set.
§Arguments
input
- a JWT string representation.jwk_set
- a JWK set.selector
- a function for selecting the verifying algorithm.
sourcepub fn decode_with_decrypter(
&self,
input: impl AsRef<[u8]>,
decrypter: &dyn JweDecrypter
) -> Result<(JwtPayload, JweHeader), JoseError>
pub fn decode_with_decrypter( &self, input: impl AsRef<[u8]>, decrypter: &dyn JweDecrypter ) -> Result<(JwtPayload, JweHeader), JoseError>
Return the JWT object decoded by the selected decrypter.
§Arguments
input
- a JWT string representation.decrypter
- a decrypter of the decrypting algorithm.
sourcepub fn decode_with_decrypter_selector<'a, F>(
&self,
input: impl AsRef<[u8]>,
selector: F
) -> Result<(JwtPayload, JweHeader), JoseError>
pub fn decode_with_decrypter_selector<'a, F>( &self, input: impl AsRef<[u8]>, selector: F ) -> Result<(JwtPayload, JweHeader), JoseError>
Return the JWT object decoded with a selected decrypting algorithm.
§Arguments
input
- a JWT string representation.decrypter_selector
- a function for selecting the decrypting algorithm.
sourcepub fn decode_with_decrypter_in_jwk_set<F>(
&self,
input: impl AsRef<[u8]>,
jwk_set: &JwkSet,
selector: F
) -> Result<(JwtPayload, JweHeader), JoseError>
pub fn decode_with_decrypter_in_jwk_set<F>( &self, input: impl AsRef<[u8]>, jwk_set: &JwkSet, selector: F ) -> Result<(JwtPayload, JweHeader), JoseError>
Return the JWT object decoded by using a JWK set.
§Arguments
input
- a JWT string representation.jwk_set
- a JWK set.selector
- a function for selecting the decrypting algorithm.
Trait Implementations§
source§impl Clone for JwtContext
impl Clone for JwtContext
source§fn clone(&self) -> JwtContext
fn clone(&self) -> JwtContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for JwtContext
impl Debug for JwtContext
source§impl PartialEq for JwtContext
impl PartialEq for JwtContext
source§fn eq(&self, other: &JwtContext) -> bool
fn eq(&self, other: &JwtContext) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for JwtContext
impl StructuralPartialEq for JwtContext
Auto Trait Implementations§
impl Freeze for JwtContext
impl !RefUnwindSafe for JwtContext
impl Send for JwtContext
impl Sync for JwtContext
impl Unpin for JwtContext
impl !UnwindSafe for JwtContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.