Object -
http
:
BearerAuthHandler
Representation of the Bearer Auth header handler for both inbound and outbound HTTP traffic.
Constructor
__init
(InboundAuthProvider | OutboundAuthProvider authProvider)
- authProvider InboundAuthProvider | OutboundAuthProvider
-
The
InboundAuthProvider
instance or theOutboundAuthProvider
instance
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
- authProvider InboundAuthProvider | OutboundAuthProvider
-
The
InboundAuthProvider
instance or theOutboundAuthProvider
instance
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, returnsfalse
Authenticates the incoming request with the use of credentials passed as the Bearer Auth header.
Parameters
- req Request
-
The
Request
instance
-
Return Type
(boolean | AuthenticationError) Returns
true
if authenticated successfully. Else, returnsfalse
or theAuthenticationError
in case of an error
Prepares the request with the Bearer Auth header.
Parameters
- req Request
-
The
Request
instance
-
Return Type
(Request | AuthenticationError) Returns the updated
Request
instance or theAuthenticationError
in case of an error
Inspects the request and response and calls the Auth provider for inspection.
-
Return Type
(Request | AuthenticationError | ()) Returns the updated
Request
instance, theAuthenticationError
in case of an error, or()
if nothing is to be returned