auth/auth_guard_resolver.ts view source
(auth: RouteAuth): AuthGuards import {fuz_auth_guard_resolver} from '@fuzdev/fuz_app/auth/auth_guard_resolver.js'; Standard auth guard resolver for fuz_app.
Reads each axis of the RouteAuth shape and emits the corresponding middleware:
account === 'required'oractor === 'required'→ pre-authorization require_authcredential_types?.length→ pre-authorizationrequire_credential_types(types)required_scope→ pre-authorizationrequire_token_scope(capability)roles?.length→ post-authorizationrequire_role(roles)(multi-role any-of)
Guards run in declaration order, which is the coarse-to-fine order above: presence first (an anonymous caller holds neither a credential type nor a scope to check), then the channel, then the scope, then the role — the last being the only one that needs the resolved RequestContext.
auth
returns
AuthGuards throws
Error- if `auth.required_scope` is not a well-formed capability string (via `require_token_scope`) — `RouteAuth` types it as a plain string to keep `http/` free of an `auth/` import, so this is where the value is checked. The check is on *shape*, not membership: the vocabulary is deliberately open so a consumer can name its own surface, and a `surface:` name decides nothing (rule 3 is all-or-nothing), so the closed set would only have been a spelling check on a diagnostic string. fuz_app's own declarations are pinned to the surfaces it actually mounts by the surface census.Error- if `auth.required_scope` sits on an unrestricted route (`account: 'none' && actor: 'none'`). The same holder reaches that route by dropping the credential, so the guard reads as a control and enforces nothing — the shape `compile_action_registry` refuses on an `ActionSpec` for the same reason. Extends `RouteAuth`'s leaf invariant (invariant 4, which `assert_route_auth_invariants` checks for roles and credential types).