pub struct IdToken<AC: AdditionalClaims, GC: GenderClaim, JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: JwsSigningAlgorithm>(/* private fields */);
Expand description
OpenID Connect ID token.
Implementations§
Source§impl<AC, GC, JE, JS> IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
GC: GenderClaim,
JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>,
JS: JwsSigningAlgorithm,
impl<AC, GC, JE, JS> IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
GC: GenderClaim,
JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>,
JS: JwsSigningAlgorithm,
Sourcepub fn new<S>(
claims: IdTokenClaims<AC, GC>,
signing_key: &S,
alg: JS,
access_token: Option<&AccessToken>,
code: Option<&AuthorizationCode>,
) -> Result<Self, JsonWebTokenError>where
S: PrivateSigningKey,
<S as PrivateSigningKey>::VerificationKey: JsonWebKey<SigningAlgorithm = JS>,
pub fn new<S>(
claims: IdTokenClaims<AC, GC>,
signing_key: &S,
alg: JS,
access_token: Option<&AccessToken>,
code: Option<&AuthorizationCode>,
) -> Result<Self, JsonWebTokenError>where
S: PrivateSigningKey,
<S as PrivateSigningKey>::VerificationKey: JsonWebKey<SigningAlgorithm = JS>,
Initializes an ID token with the specified claims, signed using the given signing key and algorithm.
If an access_token
and/or code
are provided, this method sets the at_hash
and/or
c_hash
claims using the given signing algorithm, respectively. Otherwise, those claims are
unchanged from the values specified in claims
.
Sourcepub fn claims<'a, K, N>(
&'a self,
verifier: &IdTokenVerifier<'_, K>,
nonce_verifier: N,
) -> Result<&'a IdTokenClaims<AC, GC>, ClaimsVerificationError>where
K: JsonWebKey<SigningAlgorithm = JS>,
N: NonceVerifier,
pub fn claims<'a, K, N>(
&'a self,
verifier: &IdTokenVerifier<'_, K>,
nonce_verifier: N,
) -> Result<&'a IdTokenClaims<AC, GC>, ClaimsVerificationError>where
K: JsonWebKey<SigningAlgorithm = JS>,
N: NonceVerifier,
Verifies and returns a reference to the ID token claims.
Sourcepub fn into_claims<K, N>(
self,
verifier: &IdTokenVerifier<'_, K>,
nonce_verifier: N,
) -> Result<IdTokenClaims<AC, GC>, ClaimsVerificationError>where
K: JsonWebKey<SigningAlgorithm = JS>,
N: NonceVerifier,
pub fn into_claims<K, N>(
self,
verifier: &IdTokenVerifier<'_, K>,
nonce_verifier: N,
) -> Result<IdTokenClaims<AC, GC>, ClaimsVerificationError>where
K: JsonWebKey<SigningAlgorithm = JS>,
N: NonceVerifier,
Verifies and returns the ID token claims.
Sourcepub fn signing_alg(&self) -> Result<&JS, SignatureVerificationError>
pub fn signing_alg(&self) -> Result<&JS, SignatureVerificationError>
Returns the JwsSigningAlgorithm
used to sign this ID token.
This function returns an error if the token is unsigned or utilizes JSON Web Encryption (JWE).
Sourcepub fn signing_key<'s, K>(
&self,
verifier: &'s IdTokenVerifier<'s, K>,
) -> Result<&'s K, SignatureVerificationError>where
K: JsonWebKey<SigningAlgorithm = JS>,
pub fn signing_key<'s, K>(
&self,
verifier: &'s IdTokenVerifier<'s, K>,
) -> Result<&'s K, SignatureVerificationError>where
K: JsonWebKey<SigningAlgorithm = JS>,
Returns the JsonWebKey
usable for verifying this ID token’s JSON Web Signature.
This function returns an error if the token has no signature or a corresponding key cannot be found.
Trait Implementations§
Source§impl<AC: Clone + AdditionalClaims, GC: Clone + GenderClaim, JE: Clone + JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: Clone + JwsSigningAlgorithm> Clone for IdToken<AC, GC, JE, JS>
impl<AC: Clone + AdditionalClaims, GC: Clone + GenderClaim, JE: Clone + JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: Clone + JwsSigningAlgorithm> Clone for IdToken<AC, GC, JE, JS>
Source§impl<AC: Debug + AdditionalClaims, GC: Debug + GenderClaim, JE: Debug + JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: Debug + JwsSigningAlgorithm> Debug for IdToken<AC, GC, JE, JS>
impl<AC: Debug + AdditionalClaims, GC: Debug + GenderClaim, JE: Debug + JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: Debug + JwsSigningAlgorithm> Debug for IdToken<AC, GC, JE, JS>
Source§impl<'de, AC, GC: GenderClaim, JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: JwsSigningAlgorithm> Deserialize<'de> for IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
impl<'de, AC, GC: GenderClaim, JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: JwsSigningAlgorithm> Deserialize<'de> for IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<AC, GC, JE, JS> FromStr for IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
GC: GenderClaim,
JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>,
JS: JwsSigningAlgorithm,
impl<AC, GC, JE, JS> FromStr for IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
GC: GenderClaim,
JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>,
JS: JwsSigningAlgorithm,
Source§impl<AC: PartialEq + AdditionalClaims, GC: PartialEq + GenderClaim, JE: PartialEq + JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: PartialEq + JwsSigningAlgorithm> PartialEq for IdToken<AC, GC, JE, JS>
impl<AC: PartialEq + AdditionalClaims, GC: PartialEq + GenderClaim, JE: PartialEq + JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: PartialEq + JwsSigningAlgorithm> PartialEq for IdToken<AC, GC, JE, JS>
Source§impl<AC, GC: GenderClaim, JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: JwsSigningAlgorithm> Serialize for IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
impl<AC, GC: GenderClaim, JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: JwsSigningAlgorithm> Serialize for IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
Source§impl<AC, GC, JE, JS> ToString for IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
GC: GenderClaim,
JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>,
JS: JwsSigningAlgorithm,
impl<AC, GC, JE, JS> ToString for IdToken<AC, GC, JE, JS>where
AC: AdditionalClaims,
GC: GenderClaim,
JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>,
JS: JwsSigningAlgorithm,
impl<AC: AdditionalClaims, GC: GenderClaim, JE: JweContentEncryptionAlgorithm<KeyType = JS::KeyType>, JS: JwsSigningAlgorithm> StructuralPartialEq for IdToken<AC, GC, JE, JS>
Auto Trait Implementations§
impl<AC, GC, JE, JS> Freeze for IdToken<AC, GC, JE, JS>
impl<AC, GC, JE, JS> RefUnwindSafe for IdToken<AC, GC, JE, JS>
impl<AC, GC, JE, JS> Send for IdToken<AC, GC, JE, JS>
impl<AC, GC, JE, JS> Sync for IdToken<AC, GC, JE, JS>
impl<AC, GC, JE, JS> Unpin for IdToken<AC, GC, JE, JS>
impl<AC, GC, JE, JS> UnwindSafe for IdToken<AC, GC, JE, JS>
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§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 more