Object - http : BearerAuthHandler

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

Constructor

__init

(InboundAuthProvider | OutboundAuthProvider authProvider)

Methods

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

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

Prepares the request with the Bearer Auth header.

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

Fields

canProcess

(Request req)

returns boolean

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

Parameters

  • req Request
  • The http:Request instance

  • Return Type

    (boolean)
  • true if it can be authenticated or else false

process

(Request req)

returns boolean | AuthenticationError

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

Parameters

  • req Request
  • The http:Request instance

  • Return Type

    (boolean | AuthenticationError)
  • true if authenticated successfully, false otherwise, or else an http:AuthenticationError in case of an error

prepare

(Request req)

returns Request | AuthenticationError

Prepares the request with the Bearer Auth header.

Parameters

  • req Request
  • Thehttp:Request instance

  • Return Type

    (Request | AuthenticationError)
  • The updated http:Request instance or else an http:AuthenticationError in case of an error

inspect

(Request req, Response resp)

returns Request | AuthenticationError | ()

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

Parameters

  • req Request
  • The http:Request instance

  • resp Response
  • The http:Response instance

  • Return Type

    (Request | AuthenticationError | ())
  • The updated http:Request instance, an http:AuthenticationError in case of an error, or else () if nothing is to be returned