pub struct JWTClaims { /* private fields */ }Expand description
The JWT decoded content. It consists of 2 key-value maps: one for the JWT header and another one for the JWT body.
Implementations§
Source§impl JWTClaims
impl JWTClaims
Sourcepub fn new(
expiration: Option<DateTime<Utc>>,
not_before: Option<DateTime<Utc>>,
issued_at: Option<DateTime<Utc>>,
claims: HashMap<String, Value>,
headers: HashMap<String, Value>,
) -> Result<Self, JWTError>
pub fn new( expiration: Option<DateTime<Utc>>, not_before: Option<DateTime<Utc>>, issued_at: Option<DateTime<Utc>>, claims: HashMap<String, Value>, headers: HashMap<String, Value>, ) -> Result<Self, JWTError>
Create a new JWTClaims with the given expiration,
not before, issued at, claims and headers.
Sourcepub fn not_before(&self) -> Option<DateTime<Utc>>
pub fn not_before(&self) -> Option<DateTime<Utc>>
Get the not before claim.
Sourcepub fn expiration(&self) -> Option<DateTime<Utc>>
pub fn expiration(&self) -> Option<DateTime<Utc>>
Get the expiration claim.
Sourcepub fn get_claim<T>(&self, name: &str) -> Option<T>where
T: ValueRetrieval,
pub fn get_claim<T>(&self, name: &str) -> Option<T>where
T: ValueRetrieval,
Get a specific claim by name with type conversion.
Sourcepub fn has_header(&self, name: &str) -> bool
pub fn has_header(&self, name: &str) -> bool
Check if a specific header exists.
Sourcepub fn get_header(&self, name: &str) -> Option<String>
pub fn get_header(&self, name: &str) -> Option<String>
Get a specific header by name as string.
Sourcepub fn get_claims(&self) -> Value
pub fn get_claims(&self) -> Value
Get all JWT claims as PDK script value.
Sourcepub fn get_headers(&self) -> Value
pub fn get_headers(&self) -> Value
Get all JWT headers as PDK script value.
Trait Implementations§
impl Eq for JWTClaims
impl StructuralPartialEq for JWTClaims
Auto Trait Implementations§
impl Freeze for JWTClaims
impl RefUnwindSafe for JWTClaims
impl Send for JWTClaims
impl Sync for JWTClaims
impl Unpin for JWTClaims
impl UnwindSafe for JWTClaims
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