pub struct AccessToken(pub String);Expand description
A signed access token (JWT string).
Tuple Fields§
§0: StringImplementations§
Source§impl AccessToken
impl AccessToken
Sourcepub fn for_user(
user_id: Uuid,
username: &str,
is_admin: bool,
config: &JwtConfig,
) -> Result<Self, AuthError>
pub fn for_user( user_id: Uuid, username: &str, is_admin: bool, config: &JwtConfig, ) -> Result<Self, AuthError>
Sourcepub fn decode(
token: &str,
config: &JwtConfig,
) -> Result<AccessTokenClaims, AuthError>
pub fn decode( token: &str, config: &JwtConfig, ) -> Result<AccessTokenClaims, AuthError>
Decode and validate an access token.
§Errors
Returns AuthError::Jwt if the token is invalid, expired, or not an access token.
Auto Trait Implementations§
impl Freeze for AccessToken
impl RefUnwindSafe for AccessToken
impl Send for AccessToken
impl Sync for AccessToken
impl Unpin for AccessToken
impl UnsafeUnpin for AccessToken
impl UnwindSafe for AccessToken
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