Authentication resolution for Cyber Ware — validates bearer tokens and produces a SecurityContext.
The authorization design that Cyber Ware operates on is described in DESIGN.md. The decision to split authentication and authorization into separate resolvers is documented in ADR-0002 and the minimalist interface choice in ADR-0003.
The authn_resolver module provides a single responsibility: convert a bearer token into a validated identity (SecurityContext). The resolver is a integration point — it discovers and delegates to a vendor-specific plugin via the types-registry. The actual token validation logic lives in the plugin.
The module registers AuthNResolverClient in ClientHub:
authenticate(bearer_token)— Validate bearer token and returnAuthenticationResult
Contains a SecurityContext with:
subject_id— Authenticated user/service identitysubject_type— Optional GTS type identifiersubject_tenant_id— Home tenant of the subject (required)token_scopes— Permission scopes (["*"]for first-party apps)bearer_token— Optionally preserved for downstream PDP forwarding
See error.rs: Unauthorized, NoPluginAvailable, ServiceUnavailable, Internal
Plugins implement AuthNResolverPluginClient and register via GTS.
Cyber Ware includes one plugin out of the box:
static_authn_plugin— Config-based plugin for development and testing
See config.rs
modules:
authn_resolver:
vendor: "cyberfabric" # Selects plugin by matching vendorSee config.rs
modules:
static_authn_plugin:
vendor: "cyberfabric"
priority: 100
mode: accept_all # accept_all | static_tokens
default_identity:
subject_id: "00000000-0000-0000-0000-000000000001"
subject_tenant_id: "00000000-0000-0000-0000-000000000001"
token_scopes: ["*"]
tokens: [] # Used in static_tokens modeModes:
accept_all— Accepts any non-empty token, returns the default identity (development convenience)static_tokens— Maps specific tokens to specific identities; returnsUnauthorizedon mismatch
// API Gateway middleware
let authn = hub.get::<dyn AuthNResolverClient>()?;
let result = authn.authenticate("Bearer abc123").await?;
// result.security_context contains validated identityThe API Gateway consumes AuthNResolverClient in its authentication middleware. When auth_disabled: true is set in the gateway config, a default SecurityContext is injected without calling the resolver (development convenience).
- Single
authenticateAPI - Plugin discovery via types-registry
- Static plugin with
accept_allandstatic_tokensmodes - ClientHub registration for in-process consumption
- JWKS-based token validation
- Standard OIDC claims mapping to
SecurityContext