pub struct JsonWebTokenCredential { /* private fields */ }Expand description
Credential wrapping a JWT (JSON Web Token).
From a private secret or private key, this will create short-lived tokens in JWT format. The credential can be used indefintely, but the underlying token will be rotated before it expires.
Implementations§
Source§impl JsonWebTokenCredential
impl JsonWebTokenCredential
Sourcepub fn new(header: Header, key: EncodingKey, expiration: Duration) -> Self
pub fn new(header: Header, key: EncodingKey, expiration: Duration) -> Self
Create a JWT credential with specific properties.
The header and key parameters are set as for jsonwebtoken.
The expiration parameter controls how long the token will be valid. Endpoints may restrict
tokens to a maximum lifetime. Tokens are rotated after half the expiration time, to ensure
that they have a reasonable remaining time to be used.
pub fn with_issuer(self, issuer: impl Into<Cow<'static, str>>) -> Self
Trait Implementations§
Source§impl AuthenticationCredential for JsonWebTokenCredential
impl AuthenticationCredential for JsonWebTokenCredential
Auto Trait Implementations§
impl !Freeze for JsonWebTokenCredential
impl RefUnwindSafe for JsonWebTokenCredential
impl Send for JsonWebTokenCredential
impl Sync for JsonWebTokenCredential
impl Unpin for JsonWebTokenCredential
impl UnwindSafe for JsonWebTokenCredential
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