pub struct CallerIdentity { /* private fields */ }Expand description
Authenticated caller metadata supplied by an adapter boundary.
Implementations§
Source§impl CallerIdentity
impl CallerIdentity
Sourcepub fn new(
subject: impl Into<String>,
namespaces: impl IntoIterator<Item = String>,
) -> Self
pub fn new( subject: impl Into<String>, namespaces: impl IntoIterator<Item = String>, ) -> Self
Build a caller identity whose namespace grants came from the
development x-aion-namespaces header.
Sourcepub fn from_token_claims(
subject: impl Into<String>,
namespaces: impl IntoIterator<Item = String>,
) -> Self
pub fn from_token_claims( subject: impl Into<String>, namespaces: impl IntoIterator<Item = String>, ) -> Self
Build a caller identity whose namespace grants came from a validated token’s namespace claim (the real JWT path), so denial messages direct the operator to the token grant instead of the development header.
Sourcepub fn operator(subject: impl Into<String>) -> Self
pub fn operator(subject: impl Into<String>) -> Self
Build the single-tenant operator identity: full access to every
namespace plus EVERY grant word in
crate::namespace::grants::GRANT_WORDS, with no namespaces
enumerated.
This is the server’s request-time decision when no auth is configured
(auth.enabled == false): the caller IS the operator. It is constructed
only at an adapter boundary that has already established auth is off; it
must never be reachable on the auth-enabled path, where grants come from
validated token claims (or the development-token path).
Sourcepub fn with_deploy(self, deploy: bool) -> Self
pub fn with_deploy(self, deploy: bool) -> Self
Attach the deployment-wide deploy grant decision to this identity.
The grant is engine-global, never namespace-scoped: loading a package re-points routing for a workflow type that is startable from every namespace, so a namespace-valued grant would promise an isolation the engine does not provide.
Sourcepub const fn deploy_granted(&self) -> bool
pub const fn deploy_granted(&self) -> bool
Whether the caller holds the deployment-wide deploy grant.
Sourcepub fn with_assistant_sessions(self, assistant_sessions: bool) -> Self
pub fn with_assistant_sessions(self, assistant_sessions: bool) -> Self
Attach the assistant.sessions grant decision to this identity.
Like Self::with_deploy, the grant is deployment-wide rather than
namespace-scoped: an assistant session is a server-owned harness
process, not a record inside one namespace, so a namespace-valued grant
would promise an isolation the session boundary does not provide.
Sourcepub const fn assistant_sessions_granted(&self) -> bool
pub const fn assistant_sessions_granted(&self) -> bool
Whether the caller holds the assistant.sessions grant: permission to
start and drive server-owned assistant harness sessions.
Sourcepub fn denied(subject: impl Into<String>, reason: impl Into<String>) -> Self
pub fn denied(subject: impl Into<String>, reason: impl Into<String>) -> Self
Build a caller identity that must be denied with a transport-specific reason.
Sourcepub fn namespaces(&self) -> Vec<String>
pub fn namespaces(&self) -> Vec<String>
Namespaces this caller is authorized for, in sorted order.
Backed by a BTreeSet, so the returned vector is already
lexicographically ordered with no duplicates.
Sourcepub const fn all_namespaces(&self) -> bool
pub const fn all_namespaces(&self) -> bool
Whether this caller holds access to every namespace without enumerating
them. True only for the single-tenant operator identity (auth-off
operator mode); the all-access grant is signaled here, not by
Self::namespaces, which stays the explicit (empty) set.
Trait Implementations§
Source§impl Clone for CallerIdentity
impl Clone for CallerIdentity
Source§fn clone(&self) -> CallerIdentity
fn clone(&self) -> CallerIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CallerIdentity
impl Debug for CallerIdentity
impl Eq for CallerIdentity
Source§impl PartialEq for CallerIdentity
impl PartialEq for CallerIdentity
impl StructuralPartialEq for CallerIdentity
Auto Trait Implementations§
impl Freeze for CallerIdentity
impl RefUnwindSafe for CallerIdentity
impl Send for CallerIdentity
impl Sync for CallerIdentity
impl Unpin for CallerIdentity
impl UnsafeUnpin for CallerIdentity
impl UnwindSafe for CallerIdentity
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request