Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

  • {}

Index

Constructors

constructor

Properties

_serviceEvents

_serviceEvents: string[]

app

app: Application

configKey

configKey: string

Optional id

id: any

methods

methods: {}

Type declaration

  • [method: string]: string[]

strategies

strategies: {}

Type declaration

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

configuration

  • get configuration(): any
  • Return the current configuration from the application

    Returns any

strategyNames

  • get strategyNames(): string[]
  • A list of all registered strategy names

    Returns string[]

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

authenticate

  • Authenticate a given authentication request against a list of strategies.

    Parameters

    • authentication: AuthenticationRequest

      The authentication request

    • params: Params

      Service call parameters

    • Rest ...allowed: string[]

      A list of allowed strategy names

    Returns Promise<AuthenticationResult>

create

  • Create and return a new JWT for a given authentication request. Will trigger the login event.

    Parameters

    • data: AuthenticationRequest

      The authentication request (should include strategy key)

    • params: Params

      Service call parameters

    Returns Promise<AuthenticationResult>

createAccessToken

  • Create a new access token with payload and options.

    Parameters

    • payload: string | Buffer | object

      The JWT payload

    • Optional optsOverride: SignOptions

      The options to extend the defaults (configuration.jwtOptions) with

    • Optional secretOverride: Secret

      Use a different secret instead

    Returns Promise<any>

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number

getPayload

  • Return the payload for a JWT based on the authentication result. Called internally by the create method.

    Parameters

    • _authResult: AuthenticationResult

      The current authentication result

    • params: Params

      The service call parameters

    Returns Promise<any>

getStrategies

  • Get the registered authentication strategies for a list of names.

    Parameters

    • Rest ...names: string[]

      The list or strategy names

    Returns AuthenticationStrategy[]

getTokenOptions

  • Returns the JWT options based on an authentication result. By default sets the JWT subject to the entity id.

    Parameters

    Returns Promise<any>

handleConnection

hooks

  • hooks(hooks: Partial<HooksObject>): this

listenerCount

  • listenerCount(type: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

parse

  • Parse an HTTP request and response for authentication request information.

    Parameters

    • req: IncomingMessage

      The HTTP request

    • res: ServerResponse

      The HTTP response

    • Rest ...names: string[]

      A list of strategies to use

    Returns Promise<AuthenticationRequest>

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this

publish

rawListeners

  • rawListeners(event: string | symbol): Function[]

register

  • Register a new authentication strategy under a given name.

    Parameters

    • name: string

      The name to register the strategy under

    • strategy: AuthenticationStrategy

      The authentication strategy instance

    Returns void

registerPublisher

remove

  • Mark a JWT as removed. By default only verifies the JWT and returns the result. Triggers the logout event.

    Parameters

    • id: string | null

      The JWT to remove or null

    • params: Params

      Service call parameters

    Returns Promise<AuthenticationResult>

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this

setup

  • setup(): void
  • Validates the service configuration.

    Returns void

verifyAccessToken

  • Verifies an access token.

    Parameters

    • accessToken: string

      The token to verify

    • Optional optsOverride: JwtVerifyOptions

      The options to extend the defaults (configuration.jwtOptions) with

    • Optional secretOverride: Secret

      Use a different secret instead

    Returns Promise<any>

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc