@gibme/webserver
    Preparing search index...

    Type Alias ProtectedRouter

    ProtectedRouter: express.Router & {
        _protectedRouterProvider: () => AuthenticationProvider | undefined;
        "[ProtectedRouterBrand]": true;
        setAuthenticationProvider: (provider?: AuthenticationProvider) => void;
    }

    Creates a mountable Router instance whose routes registered via verb methods (get/post/put/patch/delete/head/options/all/connect/trace) or route() are all gated by an authentication provider. Middleware registered via router.use(...) is intentionally NOT auto-gated; the gate is route-scoped to keep mount-order behavior predictable for downstream callers.

    Behaves like the exported Router() factory (including optional route-parameter rewriting), with the addition of setAuthenticationProvider.

    Type Declaration

    • Internal_protectedRouterProvider: () => AuthenticationProvider | undefined

      Internal accessor returning the currently-configured authentication provider. Used by transports outside the HTTP middleware chain (e.g. the WebSocket upgrade path) so they can inherit the router's auth without snapshotting it.

    • Readonly[ProtectedRouterBrand]: true

      Brand marker used by other helpers to detect a ProtectedRouter without coupling to its concrete type. Always true on ProtectedRouter instances.

    • setAuthenticationProvider: (provider?: AuthenticationProvider) => void

      Sets the authentication provider used to gate every route registered on this router. The provider is consulted on each request, so calling this after routes are already registered updates authentication for all of them.