Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ChainAuth

Chain several authentication providers as if they were one. This is useful for cases where one want to authenticate across several providers, for example, database and fallback to passwd file.

Hierarchy

Index

Methods

add

  • Appends a auth provider to the chain.

    Parameters

    Returns ChainAuth

authenticate

  • authenticate(credentials: {}): PromiseLike<User>
  • authenticate(credentials: {}, resultHandler: ((res: AsyncResult<User>) => void) | Handler<AsyncResult<User>>): void
  • authenticate(credentials: Credentials): PromiseLike<User>
  • authenticate(credentials: Credentials, resultHandler: ((res: AsyncResult<User>) => void) | Handler<AsyncResult<User>>): void
  • Authenticate a user.

    The first argument is a JSON object containing information for authenticating the user. What this actually contains depends on the specific implementation. In the case of a simple username/password based authentication it is likely to contain a JSON object with the following structure:

      {
        "username": "tim",
        "password": "mypassword"
      }
    
    For other types of authentication it contain different information - for example a JWT token or OAuth bearer token.

    If the user is successfully authenticated a object is passed to the handler in an . The user object can then be used for authorisation.

    Parameters

    • credentials: {}
      • [key: string]: any

    Returns PromiseLike<User>

  • Authenticate a user.

    The first argument is a JSON object containing information for authenticating the user. What this actually contains depends on the specific implementation. In the case of a simple username/password based authentication it is likely to contain a JSON object with the following structure:

      {
        "username": "tim",
        "password": "mypassword"
      }
    
    For other types of authentication it contain different information - for example a JWT token or OAuth bearer token.

    If the user is successfully authenticated a object is passed to the handler in an . The user object can then be used for authorisation.

    Parameters

    • credentials: {}
      • [key: string]: any
    • resultHandler: ((res: AsyncResult<User>) => void) | Handler<AsyncResult<User>>

    Returns void

  • Authenticate a user.

    The first argument is a Credentials object containing information for authenticating the user. What this actually contains depends on the specific implementation.

    If the user is successfully authenticated a object is passed to the handler in an . The user object can then be used for authorisation.

    Parameters

    Returns PromiseLike<User>

  • Authenticate a user.

    The first argument is a Credentials object containing information for authenticating the user. What this actually contains depends on the specific implementation.

    If the user is successfully authenticated a object is passed to the handler in an . The user object can then be used for authorisation.

    Parameters

    • credentials: Credentials
    • resultHandler: ((res: AsyncResult<User>) => void) | Handler<AsyncResult<User>>

    Returns void

Static all

  • Create a Chainable Auth Provider auth provider that will resolve if all auth providers are successful.

    Returns ChainAuth

Static any

  • Create a Chainable Auth Provider auth provider that will resolve on the first success.

    Returns ChainAuth

Static create

  • Create a Chainable Auth Provider auth provider

    Returns ChainAuth

Generated using TypeDoc