pub struct AuthenticatedUser {
pub user_id: Uuid,
pub username: String,
pub is_admin: bool,
}Expand description
An authenticated user extracted from a JWT.
Use as an Axum handler parameter to enforce JWT authentication.
Requires Arc<JwtConfig> and Arc<dyn Store> to be extractable from state
via FromRef: the token is checked against the stored user on every request.
§Examples
use ironflow_auth::extractor::AuthenticatedUser;
async fn protected(user: AuthenticatedUser) -> String {
format!("Hello, {}!", user.username)
}Fields§
§user_id: UuidThe user’s unique identifier.
username: StringThe user’s username.
is_admin: boolWhether the user is an administrator.
Trait Implementations§
Source§impl Clone for AuthenticatedUser
impl Clone for AuthenticatedUser
Source§impl Debug for AuthenticatedUser
impl Debug for AuthenticatedUser
Source§impl<S> FromRequestParts<S> for AuthenticatedUser
impl<S> FromRequestParts<S> for AuthenticatedUser
Auto Trait Implementations§
impl Freeze for AuthenticatedUser
impl RefUnwindSafe for AuthenticatedUser
impl Send for AuthenticatedUser
impl Sync for AuthenticatedUser
impl Unpin for AuthenticatedUser
impl UnsafeUnpin for AuthenticatedUser
impl UnwindSafe for AuthenticatedUser
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