pub struct IdentityContext {
pub tenant: TenantId,
pub project: Option<ProjectId>,
pub agent: Option<AgentId>,
pub human_actor: Option<HumanActorId>,
pub service: Option<ServiceId>,
pub session: Option<String>,
}Expand description
Identity attributes carried with a request, evidence entry, or policy evaluation.
Fields§
§tenant: TenantIdOwning tenant. This is mandatory even for local contexts.
project: Option<ProjectId>Optional project within the tenant.
agent: Option<AgentId>Optional agent execution identity.
human_actor: Option<HumanActorId>Optional human actor who initiated or approved the action.
service: Option<ServiceId>Optional service identity used for a delegated operation.
session: Option<String>Optional session or trace-local identity.
Implementations§
Source§impl IdentityContext
impl IdentityContext
Sourcepub fn new(tenant: impl Into<TenantId>) -> Self
pub fn new(tenant: impl Into<TenantId>) -> Self
Creates a context with only its required tenant identity.
Sourcepub fn with_project(self, project: impl Into<ProjectId>) -> Self
pub fn with_project(self, project: impl Into<ProjectId>) -> Self
Sets the project scope.
Sourcepub fn with_agent(self, agent: impl Into<AgentId>) -> Self
pub fn with_agent(self, agent: impl Into<AgentId>) -> Self
Sets the agent identity.
Sourcepub fn with_human_actor(self, human_actor: impl Into<HumanActorId>) -> Self
pub fn with_human_actor(self, human_actor: impl Into<HumanActorId>) -> Self
Sets the human actor identity.
Sourcepub fn with_service(self, service: impl Into<ServiceId>) -> Self
pub fn with_service(self, service: impl Into<ServiceId>) -> Self
Sets the delegated service identity.
Sourcepub fn with_session(self, session: impl Into<String>) -> Self
pub fn with_session(self, session: impl Into<String>) -> Self
Sets the session identity.
Sourcepub fn tenant_id(&self) -> &TenantId
pub fn tenant_id(&self) -> &TenantId
Returns the tenant without exposing mutable identity state.
Sourcepub fn scope(&self) -> IdentityScope
pub fn scope(&self) -> IdentityScope
Returns the most specific declared scope for this context.
Trait Implementations§
Source§impl Clone for IdentityContext
impl Clone for IdentityContext
Source§impl Debug for IdentityContext
impl Debug for IdentityContext
Source§impl<'de> Deserialize<'de> for IdentityContext
impl<'de> Deserialize<'de> for IdentityContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for IdentityContext
Source§impl PartialEq for IdentityContext
impl PartialEq for IdentityContext
Source§impl PolicyContext for IdentityContext
impl PolicyContext for IdentityContext
Source§fn classification(&self) -> Option<SecurityClassification>
fn classification(&self) -> Option<SecurityClassification>
Returns a classification when the context carries one.
Source§fn identity(&self) -> Option<&IdentityContext>
fn identity(&self) -> Option<&IdentityContext>
Returns an identity when the context carries one.
Source§impl Serialize for IdentityContext
impl Serialize for IdentityContext
impl StructuralPartialEq for IdentityContext
Source§impl TenantBoundary for IdentityContext
impl TenantBoundary for IdentityContext
Auto Trait Implementations§
impl Forget for IdentityContext
impl Freeze for IdentityContext
impl Move for IdentityContext
impl RefUnwindSafe for IdentityContext
impl Send for IdentityContext
impl Sync for IdentityContext
impl Unpin for IdentityContext
impl UnsafeUnpin for IdentityContext
impl UnwindSafe for IdentityContext
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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