pub struct TokenValidator { /* private fields */ }Expand description
Token validator for JWT tokens
Implementations§
Source§impl TokenValidator
impl TokenValidator
Sourcepub fn new(secret: &str, issuer: String, audience: String) -> Self
pub fn new(secret: &str, issuer: String, audience: String) -> Self
Create a new token validator
Sourcepub fn validate_token(&self, token: &str) -> SecurityResult<JwtClaims>
pub fn validate_token(&self, token: &str) -> SecurityResult<JwtClaims>
Validate a JWT token and return the claims
Sourcepub fn create_token(&self, claims: &JwtClaims) -> SecurityResult<String>
pub fn create_token(&self, claims: &JwtClaims) -> SecurityResult<String>
Create a JWT token from claims
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TokenValidator
impl RefUnwindSafe for TokenValidator
impl Send for TokenValidator
impl Sync for TokenValidator
impl Unpin for TokenValidator
impl UnwindSafe for TokenValidator
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