pub struct SecurityContext { /* private fields */ }Expand description
SecurityContext encapsulates the security-related information for a request or operation.
Built by the AuthN Resolver during authentication and passed through the request lifecycle.
Modules use this context together with the AuthZ Resolver to obtain access scopes.
Implementations§
Source§impl SecurityContext
impl SecurityContext
Sourcepub fn builder() -> SecurityContextBuilder
pub fn builder() -> SecurityContextBuilder
Create a new SecurityContext builder
Sourcepub fn anonymous() -> Self
pub fn anonymous() -> Self
Create an anonymous SecurityContext with no tenant, subject, or permissions.
Use this for unauthenticated / dev / auth-disabled contexts where no authenticated subject exists.
Sourcepub fn subject_id(&self) -> Uuid
pub fn subject_id(&self) -> Uuid
Get the subject ID (user, service, or system) associated with the security context
Sourcepub fn subject_type(&self) -> Option<&str>
pub fn subject_type(&self) -> Option<&str>
Get the subject type classification (e.g., “user”, “service”).
Sourcepub fn subject_tenant_id(&self) -> Uuid
pub fn subject_tenant_id(&self) -> Uuid
Get the subject’s home tenant ID (from AuthN token).
Sourcepub fn token_scopes(&self) -> &[String]
pub fn token_scopes(&self) -> &[String]
Get the token scopes. ["*"] means first-party / unrestricted.
Sourcepub fn bearer_token(&self) -> Option<&SecretString>
pub fn bearer_token(&self) -> Option<&SecretString>
Get the original bearer token (for PDP forwarding).
Trait Implementations§
Source§impl Clone for SecurityContext
impl Clone for SecurityContext
Source§fn clone(&self) -> SecurityContext
fn clone(&self) -> SecurityContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more