pub struct AuthContext {
pub domain: String,
pub authenticated: bool,
pub principal: String,
pub claims: BTreeMap<String, String>,
}Expand description
Authentication state attached to every RPC call.
Mirrors the canonical Python frozen dataclass
(vgi_rpc.rpc._common.AuthContext). Anonymous callers get the value
returned by AuthContext::anonymous.
Fields§
§domain: StringLogical auth domain (e.g. “bearer”, “mtls”, “oauth:issuer.example”). Empty for anonymous callers.
authenticated: booltrue when the call was authenticated (even if principal is empty).
principal: StringPrincipal name (e.g. subject DN, OAuth sub claim, bearer token alias).
claims: BTreeMap<String, String>Opaque string-keyed claims (e.g. JWT claims, cert extensions).
Implementations§
Source§impl AuthContext
impl AuthContext
Sourcepub fn for_principal(
domain: impl Into<String>,
principal: impl Into<String>,
) -> Self
pub fn for_principal( domain: impl Into<String>, principal: impl Into<String>, ) -> Self
Build an authenticated context with a principal and optional domain.
Sourcepub fn require_authenticated(&self) -> Result<()>
pub fn require_authenticated(&self) -> Result<()>
Require authentication; returns a PermissionError when anonymous.
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 moreSource§impl Debug for AuthContext
impl Debug for AuthContext
Source§impl Default for AuthContext
impl Default for AuthContext
Source§fn default() -> AuthContext
fn default() -> AuthContext
Returns the “default value” for a type. Read more
Auto 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§
impl<T> Allocation for T
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