Skip to main content

Class: MFAStrategyOptions

Defined in: src/auth/MFAStrategy.ts:44

Describes the configuration options that can be used to initialize MFAStrategy.

Constructors

Constructor

new MFAStrategyOptions(): MFAStrategyOptions

Returns

MFAStrategyOptions

Properties

fidoConfig?

optional fidoConfig?: PasskeyConfig

Defined in: src/auth/MFAStrategy.ts:52

The FIDO2/Passkey configuration to use when a FIDO2 secondary auth is used.


headerKey

headerKey: string = "authorization"

Defined in: src/auth/MFAStrategy.ts:46

The name of the header to look for when performing header based authentication. Default value is Authorization.


headerScheme

headerScheme: string = "basic"

Defined in: src/auth/MFAStrategy.ts:48

The authorization scheme type when using header based authentication. Default value is basic.


require2FA

require2FA: boolean = true

Defined in: src/auth/MFAStrategy.ts:57

Set to true to require that user's must provide secondary authentication to succeed, otherwise set to false. Default is true.

Methods

getMethod()

getMethod(id): Promise<MFAMethod | undefined>

Defined in: src/auth/MFAStrategy.ts:63

Retrieves the user's secondary authentication method for a given id. NOTE: You must override this function when using this strategy.

Parameters

id

string

The unique id of the secondary auth method to retrieve.

Returns

Promise<MFAMethod | undefined>


getMethods()

getMethods(id): Promise<MFAMethod[]>

Defined in: src/auth/MFAStrategy.ts:71

Retrieves the list of secondary authentication methods for the user with the given id. NOTE: You must override this function when using this strategy.

Parameters

id

string

The unique id of the user.

Returns

Promise<MFAMethod[]>


getUser()

getUser(uid): Promise<JWTUser | undefined>

Defined in: src/auth/MFAStrategy.ts:79

Retrieves the user data for the given unique identifier after authentication has completed successfully. NOTE: You must override this function when using this strategy.

Parameters

uid

string

Returns

Promise<JWTUser | undefined>


notifyContact()

notifyContact(contact, totp): Promise<void>

Defined in: src/auth/MFAStrategy.ts:88

Sends a notification to the specified contact with the provided MFA code. NOTE: You must override this function when using this strategy.

Parameters

contact

OTPContact

The contact to send the MFA code to.

totp

string

The MFA code to send to the user.

Returns

Promise<void>


verify()

verify(id, password): Promise<JWTUser | undefined>

Defined in: src/auth/MFAStrategy.ts:98

Called to verify the provided user's id and password. NOTE: You must override this function when using this strategy.

Parameters

id

string

The unique id of the user whose password must be verified.

password

string

The password of the user to verify.

Returns

Promise<JWTUser | undefined>

The successfully verified user data, otherwise undefined.