pub struct SessionContext { /* private fields */ }Expand description
Attach-scoped state cached onto every fid derived from the attach fid.
The public constructor is intentionally named for its trust precondition:
only an AttachAuthenticator that has verified the presented token and
DPoP sender binding may construct a permitting session. There is no
constructor from raw uname, Subject, claims, paths, or labels.
Implementations§
Source§impl SessionContext
impl SessionContext
Sourcepub fn from_verified_token(
attach_identity: VerifiedAttachIdentity,
security_context: SecurityContext,
token: VerifiedTokenScope,
) -> Self
pub fn from_verified_token( attach_identity: VerifiedAttachIdentity, security_context: SecurityContext, token: VerifiedTokenScope, ) -> Self
Combine a verified subject context with the scope of the same verified, sender-bound token.
Sourcepub fn from_verified_clearance(
attach_identity: VerifiedAttachIdentity,
security_context: SecurityContext,
) -> Self
pub fn from_verified_clearance( attach_identity: VerifiedAttachIdentity, security_context: SecurityContext, ) -> Self
A session with a verified clearance but no sender-bound token.
Every op denies at the token gate (Self::token_authorizes returns
false when token is None). This is the fail-closed structural
constructor for the #698 / S6 token path that is not yet wired: the
monitor is installed, clearance derivation is real (or fail-closed via
the clearance source), but no capability token has been minted yet, so
the session cannot authorize any operation. There is no permissive
default.
Once the S6 grant path issues a sender-bound token at Tattach, the
production authenticator will construct via
from_verified_token instead.
Sourcepub fn deny() -> Self
pub fn deny() -> Self
A deliberately unusable session for an invalid or absent credential. The anonymous security floor is kept for diagnostics; the missing token makes every operation deny before the AVC/PDP is reached.
Sourcepub fn verified_attach_identity(&self) -> Option<&VerifiedAttachIdentity>
pub fn verified_attach_identity(&self) -> Option<&VerifiedAttachIdentity>
Verified, tenant-bound attach identity, absent for a fail-closed session.
Sourcepub fn security_context(&self) -> &SecurityContext
pub fn security_context(&self) -> &SecurityContext
The context derived at attach from verified identity and key material.
Apply the mandatory verified-token gate. A missing token is deny.
Sourcepub fn same_attach_identity(&self, other: &SessionContext) -> bool
pub fn same_attach_identity(&self, other: &SessionContext) -> bool
Identity comparison for re-attach detection, deliberately distinct from
the derived PartialEq.
Two attaches are the same session when their verified identity,
verified subject context, and verified-token scope (label ceiling +
permitted operations) match.
The token’s valid_until deadline is excluded on purpose: a real
AttachAuthenticator re-stamps Instant::now() + ttl on every
verification of the same ticket, so including it would make an
identical, still-valid ticket compare unequal and wrongly reject a
legitimate re-attach/reconnect (F2). The derived PartialEq is plain
value equality (useful for diagnostics/tests); attach identity — what
bind_attach_session checks — is this method.
Trait Implementations§
Source§impl Clone for SessionContext
impl Clone for SessionContext
Source§fn clone(&self) -> SessionContext
fn clone(&self) -> SessionContext
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 SessionContext
impl Debug for SessionContext
Source§impl PartialEq for SessionContext
impl PartialEq for SessionContext
Source§fn eq(&self, other: &SessionContext) -> bool
fn eq(&self, other: &SessionContext) -> bool
self and other values to be equal, and is used by ==.impl Eq for SessionContext
impl StructuralPartialEq for SessionContext
Auto Trait Implementations§
impl Freeze for SessionContext
impl RefUnwindSafe for SessionContext
impl Send for SessionContext
impl Sync for SessionContext
impl Unpin for SessionContext
impl UnsafeUnpin for SessionContext
impl UnwindSafe for SessionContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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