Object - http : BearerAuthHandler

Representation of the Bearer Auth header handler for both inbound and outbound HTTP traffic.

Constructor

__init

(InboundAuthProvider | OutboundAuthProvider authProvider)

Methods

Fields

canHandle

(Request req)

returns boolean

Checks if the request can be authenticated with the Bearer Auth header.

Parameters

  • req Request
  • The Request instance.

  • Return Type

    (boolean)
  • Returns true if can be authenticated. Else, returns false.

handle

(Request req)

returns boolean | error

Authenticates the incoming request with the use of credentials passed as the Bearer Auth header.

Parameters

  • req Request
  • The Request instance.

  • Return Type

    (boolean | error)
  • Returns true if authenticated successfully. Else, returns false or the error in case of an error.

prepare

(Request req)

returns Request | error

Prepares the request with the Bearer Auth header.

Parameters

  • Return Type

    (Request | error)
  • Returns the updated Request instance or the error in case of an error.

inspect

(Request req, Response resp)

returns Request | error | ()

Inspects the request and response and calls the Auth provider for inspection.

req - The Request instance. resp - The Response instance.

Parameters

  • Return Type

    (Request | error | ())
  • Returns the updated Request instance, the error in case of an error, or () if nothing is to be returned.