Interface HttpInterceptorRouteConfig

Configuration for a single interceptor route

interface HttpInterceptorRouteConfig {
    allowAnonymous?: boolean;
    httpMethod?: string;
    tokenOptions?: GetTokenSilentlyOptions;
    uri?: string;
    uriMatcher?: ((uri) => boolean);
}

Properties

allowAnonymous?: boolean

Allow the HTTP call to be executed anonymously, when no token is available.

When omitted (or set to false), calls that match the configuration will fail when no token is available.

httpMethod?: string

The HTTP method to match on. If specified, the HTTP method of the outgoing request will be checked against this. If there is no match, the Authorization header is not attached.

The HTTP method name is case-sensitive.

tokenOptions?: GetTokenSilentlyOptions

The options that are passed to the SDK when retrieving the access token to attach to the outgoing request.

uri?: string

The URL to test, by supplying the URL to match. If test is a match for the current request path from the HTTP client, then an access token is attached to the request in the "Authorization" header.

If the test does not pass, the request proceeds without the access token attached.

A wildcard character can be used to match only the start of the URL.

Usagenotes

'/api' - exactly match the route /api '/api/*' - match any route that starts with /api/

uriMatcher?: ((uri) => boolean)

Type declaration

    • (uri): boolean
    • A function that will be called with the HttpRequest.url value, allowing you to do any kind of flexible matching.

      If this function returns true, then an access token is attached to the request in the "Authorization" header.

      If it returns false, the request proceeds without the access token attached.

      Parameters

      • uri: string

      Returns boolean