pub struct AuthContext {
pub principal: String,
pub method: AuthMethod,
pub claims: HashMap<String, Value>,
pub admin: bool,
pub namespaces: Vec<String>,
}Expand description
Authentication context attached to each request.
Fields§
§principal: StringThe principal name (e.g., key name, JWT subject, certificate CN).
method: AuthMethodWhich authentication method was used.
claims: HashMap<String, Value>Additional claims from JWT (empty for API key / mTLS).
admin: boolWhether this credential may perform administrative operations.
Carried on the credential rather than derived from a policy engine, because the policy engine is optional and “no policy” must not mean “everyone is an admin”.
namespaces: Vec<String>Namespaces this credential may act in; empty means unrestricted.
Authentication answers who is calling; this answers whose data they may touch. Keeping the second on the credential is what stops a valid key from reading another tenant simply by changing a header.
Implementations§
Source§impl AuthContext
impl AuthContext
Sourcepub fn allows_namespace(&self, namespace: &str) -> bool
pub fn allows_namespace(&self, namespace: &str) -> bool
Whether this credential may act in namespace.
Trait Implementations§
Source§impl Clone for AuthContext
impl Clone for AuthContext
Source§fn clone(&self) -> AuthContext
fn clone(&self) -> AuthContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthContext
impl RefUnwindSafe for AuthContext
impl Send for AuthContext
impl Sync for AuthContext
impl Unpin for AuthContext
impl UnsafeUnpin for AuthContext
impl UnwindSafe for AuthContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
Converts
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> ⓘ
Converts
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