@cldn/web-ts - v0.4.0
    Preparing search index...

    Interface Authenticator<A>

    Handles authentication for requests.

    interface Authenticator<A extends any> {
        authenticate(request: Request<A>): Promise<null | Authorisation<A>>;
        canAuthenticate(request: Request<A>): boolean;
    }

    Type Parameters

    • A extends any
    Index

    Methods

    • Authenticate the given request. If authentication fails, e.g. due to missing or invalid information, such as credentials, the authenticator should return null, which can be communicated to the client by implementing applications using a 401 status response.

      Parameters

      Returns Promise<null | Authorisation<A>>

    • Check whether this can handle authentication for the given request. The authenticator should return false if the request lacks the information required to begin authentication.

      Parameters

      Returns boolean