Backstage
    Preparing search index...

    Allows plugins to register HTTP routes.

    See the service documentation for more details.

    interface HttpRouterService {
        addAuthPolicy(policy: HttpRouterServiceAuthPolicy): void;
        use(handler: Handler): void;
    }
    Index

    Methods

    • Adds an auth policy to the router. This is used to allow unauthenticated or cookie based access to parts of a plugin's API.

      Parameters

      Returns void

      The paths given follow the same pattern as the routers given to the use method, that is, they are relative to the plugin's base URL, and can contain placeholders.

      http.addAuthPolicy({
      path: '/static/:id',
      allow: 'user-cookie',
      });

      This allows limited access tokens via cookies on the /api/<plugin-id>/static/* paths, but not unauthenticated access.