pub struct AuthConfig { /* private fields */ }Expand description
2026-09-26: The loaded bearer tokens. The server shares one instance as
Arc<AuthConfig>.
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn from_file(path: &Path) -> Result<Self>
pub fn from_file(path: &Path) -> Result<Self>
2026-09-26: Load tokens from a file, one per line. Each line is trimmed
at both ends; empty lines and lines starting with # are skipped.
Errors when the file cannot be read or no token is left.
Sourcepub fn from_inline(token: &str) -> Result<Self>
pub fn from_inline(token: &str) -> Result<Self>
2026-09-26: One inline token, trimmed at both ends. An empty or all-whitespace token is an error.
Sourcepub fn token_count(&self) -> usize
pub fn token_count(&self) -> usize
2026-09-26: Number of distinct tokens loaded; the startup log in
build_auth_config prints this count.
Sourcepub fn validate(&self, presented: &[u8]) -> bool
pub fn validate(&self, presented: &[u8]) -> bool
2026-09-26: true iff presented byte-equals one of the loaded tokens.
Every loaded token is compared, even after a match, and each
comparison is ct_eq, so the time does not depend on how many
leading bytes match.
Sourcepub fn tenant_of(&self, presented: &[u8]) -> Option<LookupTenant>
pub fn tenant_of(&self, presented: &[u8]) -> Option<LookupTenant>
2026-10-04: The tenant presented authenticates as: 1 + the index of
the loaded token it equals (tokens are sorted, so the index is stable
for one tokens file); None when it equals none. Same constant-time
comparison as Self::validate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnwindSafe for AuthConfig
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more