Class JWTAuthMiddleware<Payload>

The actual middleware

Type Parameters

  • Payload

Hierarchy

  • JWTAuthMiddleware

Constructors

Properties

before: MiddlewareFn<any, any, Error, Context> = ...

Checks for an authentication token, saves its content to event.auth and throws errors if anything fishy goes on. It will pass if no authorization header is present, but will ensure that event.auth is undefined in those cases. Authorization or authorization headers will both be checked. If both exist, the middleware will throw an error. If options.tokenSource is set, then that function will be used to retrieve the token and Headers will serve as fallback.

Param

The event to check

logger: Debugger

The logger used in the module

options: IAuthOptions<Payload>

Methods