pub struct Authenticated {
pub user_id: Uuid,
pub method: AuthMethod,
}Expand description
An authenticated caller, either via API key or JWT.
If the Authorization: Bearer token starts with irfl_, API key auth is used.
Otherwise, JWT auth is attempted (cookie first, then header).
§Examples
use ironflow_auth::extractor::Authenticated;
async fn protected(auth: Authenticated) -> String {
format!("User {}", auth.user_id)
}Fields§
§user_id: UuidThe authenticated user’s ID.
method: AuthMethodThe authentication method used.
Implementations§
Source§impl Authenticated
impl Authenticated
Sourcepub fn is_admin(&self) -> bool
pub fn is_admin(&self) -> bool
Whether the authenticated caller has admin privileges.
For JWT users, checks the user’s current admin status, read from the
store at request time (the token’s is_admin claim is not trusted
for a stored user, and a role change revokes the token).
For API key users, checks the owner’s current admin status
(fetched at request time, so demotions take effect immediately).
Trait Implementations§
Source§impl Clone for Authenticated
impl Clone for Authenticated
Source§impl Debug for Authenticated
impl Debug for Authenticated
Source§impl<S> FromRequestParts<S> for Authenticated
impl<S> FromRequestParts<S> for Authenticated
Auto Trait Implementations§
impl Freeze for Authenticated
impl RefUnwindSafe for Authenticated
impl Send for Authenticated
impl Sync for Authenticated
impl Unpin for Authenticated
impl UnsafeUnpin for Authenticated
impl UnwindSafe for Authenticated
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