pub struct Jwt { /* private fields */ }Expand description
HS256 token signing and verification.
Register once in providers(); Auth::jwt resolves it from the
container.
Implementations§
Source§impl Jwt
impl Jwt
Sourcepub const DEFAULT_TTL: Duration
pub const DEFAULT_TTL: Duration
Default lifetime for issued tokens.
pub fn new(secret: impl AsRef<[u8]>) -> Self
pub fn with_ttl(self, ttl: Duration) -> Self
pub fn ttl(&self) -> Duration
Sourcepub fn sign(&self, identity: &Identity) -> Result<String>
pub fn sign(&self, identity: &Identity) -> Result<String>
Issue a token that expires after the configured TTL.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Jwt
impl RefUnwindSafe for Jwt
impl Send for Jwt
impl Sync for Jwt
impl Unpin for Jwt
impl UnsafeUnpin for Jwt
impl UnwindSafe for Jwt
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