Array of picomatch glob patterns (e.g. ["/api/**"]).
Protection-space label used in the WWW-Authenticate challenge
(RFC 6750). Typically the Keycloak realm name. Defaults to "api".
An async Fastify preHandler hook that enforces bearer-token
authentication on routes matching authPaths.
Factory that creates a Fastify
preHandlerhook enforcing bearer-token authentication on any route whose URL matches one of the given glob patterns.The returned hook is intended to be registered globally via
fastify.addHook("preHandler", createAuthPreHandler(authPaths)). For every request,request.routeOptions.urlis tested against the compiled picomatch matcher; non-matching routes pass through unconditionally.When a route is protected, token verification is delegated to the
verifyTokendecorator registered on the Fastify instance.