AuthPolicy then applies provider matching and an exact principal allowlist.
The reference HTTP router deliberately leaves only its shells, static assets,
and health endpoint public.
Auth providers
These values classify an already validated token; MobKit does not run the
provider’s browser OAuth login flow. An absent or unrecognized
provider
claim maps to GenericOidc. A token with actor_type = "service", or a
principal beginning with svc:, maps to ServiceIdentity.
Auth policy
AuthPolicy selects one default user identity provider. Service identities use
their own path and do not need to match that default:
JWT validation
MobKit’s low-level JWT implementation supportsHS256, RS256, and ES256
with P-256 keys. For a token backed by a parsed JWKS document, use the helpers
in this order:
1
Header inspection
Parse the JWT header to extract the signing algorithm (The header parser does not validate the signature. It only returns
alg) and key ID (kid):alg
and optional kid for the next steps.2
Key selection
Select a key by the token’s optional
kid and algorithm:3
Signature verification
Build the algorithm-specific verification key, then validate the signature,
issuer, audience, expiry, and not-before claims:The validated JWT contains the claims (subject, email, issuer, expiration).
validate_jwt_locally is the narrower HS256 convenience helper. It always
builds an HMAC key from JwtValidationConfig.shared_secret; it is not the
general RS256 or ES256 entry point.
Fixed trusted OIDC snapshot
The reference console auth path reads a fixed, host-trusted snapshot fromRuntimeDecisionState.trusted_oidc:
discovery_json, selects a key
from the supplied jwks_json, and requires the configured audience. It does
not fetch the JWKS URI, cache remote keys, or refresh on an unknown kid.
Rotate keys by replacing the trusted snapshot through the host’s configuration
path. Caller-supplied discovery, JWKS, and audience query parameters are
ignored.
Refreshable JwksCache
JwksCache is a separate helper for hosts that wrap an Axum router with
with_auth_layer:
JwksCacheConfig; it is not implicitly copied from
the discovery document. This middleware accepts only an Authorization: Bearer <token> header. It does not implement the console router’s
auth_token query parameter.
HS256 shared secrets
For an explicitly trusted HMAC JWK, the extraction helper takes that JWK and returns the decoded secret:Console access enforcement
After JWT validation, the provider and allowlist step is enforced byenforce_console_route_access. This function evaluates policy; it does not
verify the JWT itself:
Enforcement rules
- If
console_policy.require_app_authisfalse, this provider/allowlist check allows the request; read-only policy and optional ABAC remain separate ServiceIdentityuses its prefix and allowlist checks without matching the default user provider- Every other request provider must match
auth_policy.default_provider TestProvideris rejected even when it is the configured default- The principal must appear exactly in
auth_policy.email_allowlist
HTTP surface boundary
In the reference app router, these surfaces remain public even whenrequire_app_auth is true:
/,/favicon.ico, and/healthz/console,/console/, and/console/assets/*/flow-editor,/flow-editor/, and/flow-editor/assets/*
require_app_auth. When enabled, they accept either
Authorization: Bearer <token> or an exact auth_token query parameter.
Query values are percent-decoded, so callers must URL-encode reserved
characters. Prefer the header except where a browser or SSE bootstrap requires
a query token.
Service identity
Service accounts use theServiceIdentity provider with emails prefixed by svc::
- The email must start with
svc:and have content after the prefix - The full
svc:identity must appear in the allowlist
Validation errors
See also
- Console — how auth protects console access
- Decisions — policy enforcement
- Configuration — auth policy settings
