pub struct SecurityContext {
pub policy: Option<Arc<dyn SecurityPolicy>>,
pub credential_sources: Vec<CredentialSource>,
pub plan: Option<RouteSecurityPlan>,
pub providers: Option<Arc<ProviderRegistry>>,
}Expand description
Security context passed to a consumer before start().
Carries the route’s security classification so consumers can register
auth state before accepting connections. Declared routes carry the
SecurityPolicy from the route controller; plan-only contexts (routes
without a policy declaration) carry just the compiled
[RouteSecurityPlan] (policy = None). Authentication itself runs
through the kernel fields (plan + providers).
Fields§
§policy: Option<Arc<dyn SecurityPolicy>>Route policy, when the route declared one. None for plan-only
contexts built via SecurityContext::from_plan.
credential_sources: Vec<CredentialSource>§plan: Option<RouteSecurityPlan>Compiled RouteSecurityPlan for the route, when one has been compiled.
Phase-2 transports read the plan from here to drive per-route dispatch
enforcement. None until Task 1.8 compiles plans into the context.
providers: Option<Arc<ProviderRegistry>>Provider registry carrying the route’s named authenticators.
Phase-2 transports read providers from here (grpc 2.1, mcp 2.6, ws 2.8,
http 2.9) instead of holding their own authenticator. None for routes
built before the registry injection path lands.
Implementations§
Source§impl SecurityContext
impl SecurityContext
pub fn new(policy: impl SecurityPolicy + 'static) -> Self
pub fn from_arc(policy: Arc<dyn SecurityPolicy>) -> Self
Sourcepub fn from_plan(plan: RouteSecurityPlan) -> Self
pub fn from_plan(plan: RouteSecurityPlan) -> Self
Build a plan-only context: no policy, no providers, empty credential
sources. The controller delivers a route’s compiled classification
(e.g. the Public default for an undeclared server route) through
this form.
pub fn with_credential_sources(self, sources: Vec<CredentialSource>) -> Self
Sourcepub fn with_plan(self, plan: RouteSecurityPlan) -> Self
pub fn with_plan(self, plan: RouteSecurityPlan) -> Self
Attach the compiled RouteSecurityPlan for this route.
Sourcepub fn with_providers(self, providers: Arc<ProviderRegistry>) -> Self
pub fn with_providers(self, providers: Arc<ProviderRegistry>) -> Self
Attach the provider registry carrying this route’s named authenticators.