pub struct Payload<T = ()> {
pub iss: Option<String>,
pub sub: Option<String>,
pub aud: Option<String>,
pub exp: Option<u64>,
pub nbf: Option<u64>,
pub iat: Option<u64>,
pub jti: Option<String>,
pub claims: Option<T>,
}
Expand description
A default claim set, including the standard, or registered, claims and the ability to specify your own as custom claims.
Fields
iss: Option<String>
sub: Option<String>
aud: Option<String>
exp: Option<u64>
nbf: Option<u64>
iat: Option<u64>
jti: Option<String>
claims: Option<T>
Implementations
sourceimpl<T: Serialize + DeserializeOwned> Payload<T>
impl<T: Serialize + DeserializeOwned> Payload<T>
sourcepub fn from_base64(raw: &str) -> Result<Payload<T>>
pub fn from_base64(raw: &str) -> Result<Payload<T>>
This implementation simply parses the base64 data twice, first parsing out the standard claims then any custom claims, assigning the latter into a copy of the former before returning registered and custom claims.
sourcepub fn to_base64(&self) -> Result<String>
pub fn to_base64(&self) -> Result<String>
Renders both the standard and custom claims into a single consolidated JSON representation before encoding.
pub fn verify(&self) -> bool
Trait Implementations
sourceimpl<'de, T> Deserialize<'de> for Payload<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Payload<T> where
T: Deserialize<'de>,
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
impl<T> StructuralPartialEq for Payload<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Payload<T> where
T: RefUnwindSafe,
impl<T> Send for Payload<T> where
T: Send,
impl<T> Sync for Payload<T> where
T: Sync,
impl<T> Unpin for Payload<T> where
T: Unpin,
impl<T> UnwindSafe for Payload<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more