pub struct AuthState { /* private fields */ }Expand description
Bearer token state for authentication enforcement. Tracks valid tokens and their remaining uses.
Implementations§
Source§impl AuthState
impl AuthState
Sourcepub fn add_token(&self, token: &str, max_uses: Option<u64>)
pub fn add_token(&self, token: &str, max_uses: Option<u64>)
Add a token. max_uses of None = unlimited.
Clears the token from the deny-list if it was previously exhausted or revoked,
allowing the same token string to be re-issued.
Sourcepub fn check_and_use(&self, token: &str) -> TokenStatus
pub fn check_and_use(&self, token: &str) -> TokenStatus
Check token validity and decrement use count.
Returns Valid, Exhausted (deny-listed), or Unknown (not a hardcoded token).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AuthState
impl RefUnwindSafe for AuthState
impl Send for AuthState
impl Sync for AuthState
impl Unpin for AuthState
impl UnsafeUnpin for AuthState
impl UnwindSafe for AuthState
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