Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TwoFactorAuthStrategy<Account>

Represents 2 Factor Authentication strategy.

Type parameters

Hierarchy

  • TwoFactorAuthStrategy

Implemented by

Methods

isAuthenticationTokenValid

  • isAuthenticationTokenValid(account: Account, authenticationContext: AuthenticationContext, authenticationSessionRepositoryHolder: AuthenticationSessionRepositoryHolder): Promise<boolean>
  • Verify 2FA authentication token.

    Parameters

    • account: Account

      User account.

    • authenticationContext: AuthenticationContext

      Authentication context.

    • authenticationSessionRepositoryHolder: AuthenticationSessionRepositoryHolder

      Authentication session repository holder.

    Returns Promise<boolean>

    Whether token is valid.

onTwoFactorAuthEnabled

  • onTwoFactorAuthEnabled(account: Readonly<Account>, update: Partial<Account>): Promise<null | Record<string, any>>
  • Hook used by strategy in order to attach metadata to account when multi factor auth is enabled.

    Parameters

    • account: Readonly<Account>

      User account.

    • update: Partial<Account>

      Fields that need to be updated on user account (e.g. totp secret).

    Returns Promise<null | Record<string, any>>

    Result of the hook.

sendAuthenticationToken

  • sendAuthenticationToken(account: Account, authenticationContext: AuthenticationContext, authenticationSessionRepositoryHolder: AuthenticationSessionRepositoryHolder): Promise<void>
  • Send authentication token via side channel.

    Parameters

    • account: Account

      User account.

    • authenticationContext: AuthenticationContext

      Authentication context.

    • authenticationSessionRepositoryHolder: AuthenticationSessionRepositoryHolder

      Authentication session repository holder.

    Returns Promise<void>