pub struct AuthRequest<'a> { /* private fields */ }Expand description
Authentication request helper class.
Responsibilities: Encapsulates the raw Header list and provides convenient methods for Token extraction and validation.
Implementations§
Source§impl<'a> AuthRequest<'a>
impl<'a> AuthRequest<'a>
Sourcepub fn require_header(&self, key: &str) -> VtxResult<&str>
pub fn require_header(&self, key: &str) -> VtxResult<&str>
Retrieves a required Header value.
Behavior:
Returns an AuthDenied(401) error if the Header does not exist.
Sourcepub fn bearer_token(&self) -> Option<&str>
pub fn bearer_token(&self) -> Option<&str>
Extracts the Bearer Token.
Format support: Authorization: Bearer <token> (case-insensitive for ‘Bearer’).
Sourcepub fn require_bearer_token(&self) -> VtxResult<&str>
pub fn require_bearer_token(&self) -> VtxResult<&str>
Retrieves the required Bearer Token.
Behavior:
Returns AuthDenied(401) if the Authorization header is missing or incorrectly formatted.
Sourcepub fn basic_auth(&self) -> Option<&str>
pub fn basic_auth(&self) -> Option<&str>
Extracts Basic Auth credentials.
Auto Trait Implementations§
impl<'a> Freeze for AuthRequest<'a>
impl<'a> RefUnwindSafe for AuthRequest<'a>
impl<'a> Send for AuthRequest<'a>
impl<'a> Sync for AuthRequest<'a>
impl<'a> Unpin for AuthRequest<'a>
impl<'a> UnwindSafe for AuthRequest<'a>
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