Struct Principal
#[non_exhaustive]pub struct Principal {
pub id: PrincipalId,
pub display_id: String,
pub actor: ActorKind,
pub auth_method: AuthMethod,
pub provider_alias: Option<String>,
pub trust_domain: String,
pub mfa_verified: bool,
pub expires_at: Option<u64>,
pub revalidate_by: Option<u64>,
}Expand description
The canonical resolved principal: the single non-secret record every dispatch/audit/isolation surface consumes.
Deliberately carries NO grants and NO raw claims: effective grants are resolved from current permission-profile configuration by the shared resolver and re-resolved when the authorization-policy generation changes, so this record can be held for a connection’s lifetime without becoming a stale authorization snapshot.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: PrincipalIdCanonical ownership/audit key.
display_id: StringHuman-readable, non-authoritative display identifier (OIDC sub,
roster principal id, service client_id). Never an ownership key.
actor: ActorKindHuman or service actor.
auth_method: AuthMethodHow this principal authenticated.
provider_alias: Option<String>The <alias> of the configured provider entry that authenticated
this principal, when one exists (audit attribution).
trust_domain: StringThe trust domain of the identity source (validated issuer URL,
local, or native).
mfa_verified: boolWhether a second factor was completed.
expires_at: Option<u64>Credential expiry (UNIX seconds), when the provider imposes one.
revalidate_by: Option<u64>Provider revalidation deadline (UNIX seconds), when one applies.
Implementations§
Source§impl Principal
impl Principal
Sourcepub fn from_identity(identity: &AuthenticatedIdentity) -> Self
pub fn from_identity(identity: &AuthenticatedIdentity) -> Self
The single construction path: every Principal derives from a
provider-verified AuthenticatedIdentity, so no caller can invent
a principal with an inconsistent id/actor/trust-domain combination.
The trusted shared-operator sentinel (no distinct identity source).
Sourcepub fn auth_provider_label(&self) -> String
pub fn auth_provider_label(&self) -> String
The audit label for the verifying provider: <type>.<alias> when a
config alias exists, else the bare method label.
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
true once a distinct identity source authenticated this principal —
i.e. not unbound (AuthMethod::None) and not the shared-operator
sentinel. A2A distinct-principal routing keys on this.