Struct mas_oidc_client::jose::jwt::Jwt
source · pub struct Jwt<'a, T> { /* private fields */ }
Implementations§
source§impl<'a, T> Jwt<'a, T>
impl<'a, T> Jwt<'a, T>
sourcepub fn header(&self) -> &JsonWebSignatureHeader
pub fn header(&self) -> &JsonWebSignatureHeader
Get the JWT header
pub fn into_owned(self) -> Jwt<'static, T>
sourcepub fn verify<K, S>(&self, key: &K) -> Result<(), JwtVerificationError>where
K: Verifier<S>,
S: SignatureEncoding,
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.
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.
sourcepub fn verify_with_jwks(
&self,
jwks: &JsonWebKeySet<JsonWebKeyPublicParameters>,
) -> Result<(), NoKeyWorked>
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.
sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Get the raw JWT string as an owned String
sourcepub fn into_parts(self) -> (JsonWebSignatureHeader, T)
pub fn into_parts(self) -> (JsonWebSignatureHeader, T)
Split the JWT into its parts (header and payload).
source§impl<T> Jwt<'static, T>
impl<T> Jwt<'static, T>
sourcepub fn sign<K, S>(
header: JsonWebSignatureHeader,
payload: T,
key: &K,
) -> Result<Jwt<'static, T>, JwtSignatureError>
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.
sourcepub fn sign_with_rng<R, K, S>(
rng: &mut R,
header: JsonWebSignatureHeader,
payload: T,
key: &K,
) -> Result<Jwt<'static, T>, JwtSignatureError>
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> PartialEq for Jwt<'a, T>where
T: PartialEq,
impl<'a, T> PartialEq for Jwt<'a, T>where
T: PartialEq,
source§impl<'a, T> TryFrom<RawJwt<'a>> for Jwt<'a, T>where
T: DeserializeOwned,
impl<'a, T> TryFrom<RawJwt<'a>> for Jwt<'a, T>where
T: DeserializeOwned,
impl<'a, T> Eq for Jwt<'a, T>where
T: Eq,
impl<'a, T> StructuralPartialEq for Jwt<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Jwt<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for Jwt<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Jwt<'a, T>where
T: Send,
impl<'a, T> Sync for Jwt<'a, T>where
T: Sync,
impl<'a, T> Unpin for Jwt<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Jwt<'a, T>where
T: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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
key
and return true
if they are equal.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
key
and return true
if they are equal.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.