Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AuthenticatedLdpHandler

The central manager that connects all the necessary handlers to go from an incoming request to an executed operation.

Hierarchy

Index

Constructors

constructor

Properties

Private Readonly authorizer

authorizer: Authorizer

Private Readonly credentialsExtractor

credentialsExtractor: CredentialsExtractor

Private Readonly logger

logger: Logger = ...

Private Readonly operationHandler

operationHandler: OperationHandler

Private Readonly permissionsExtractor

permissionsExtractor: PermissionsExtractor

Private Readonly requestParser

requestParser: RequestParser

Private Readonly responseWriter

responseWriter: ResponseWriter

Methods

canHandle

  • Checks if the incoming request can be handled. The check is very non-restrictive and will usually be true. It is based on whether the incoming request can be parsed to an operation.

    Parameters

    Returns Promise<void>

    A promise resolving if this request can be handled, otherwise rejecting with an Error.

handle

  • Handles the incoming request and writes out the response. This includes the following steps:

    • Parsing the request to an Operation.
    • Extracting credentials from the request.
    • Extracting the required permissions.
    • Validating if this operation is allowed.
    • Executing the operation.
    • Writing out the response.

    Parameters

    Returns Promise<void>

    A promise resolving when the handling is finished.

handleSafe

Private runHandlers

  • Runs all handlers except writing the output to the response. This because any errors thrown here have an impact on the response.

    Parameters

    • request: Guarded<IncomingMessage>

      Incoming request.

    Returns Promise<ResponseDescription>

    A promise resolving to the generated Operation.