public final class TotpMultiFactorGenerator extends Object

Helper class used to generate a TotpMultiFactorAssertion.

Constant Summary

String FACTOR_ID

Public Method Summary

static Task<TotpSecret>
generateSecret(MultiFactorSession session)
Creates a TOTP secret as part of enrolling a TOTP (time-based one-time password) second factor.
static TotpMultiFactorAssertion
getAssertionForEnrollment(TotpSecret secret, String otp)
Creates an assertion for completing the enrollment flow.
static TotpMultiFactorAssertion
getAssertionForSignIn(String enrollmentId, String otp)
Creates an assertion for the sign-in flow.

Inherited Method Summary

Constants

public static final String FACTOR_ID

Constant Value: "totp"

Public Methods

public static Task<TotpSecret> generateSecret (MultiFactorSession session)

Creates a TOTP secret as part of enrolling a TOTP (time-based one-time password) second factor. This method uses the auth instance corresponding to the user in the MultiFactorSession.

Parameters
session MultiFactorSession.

public static TotpMultiFactorAssertion getAssertionForEnrollment (TotpSecret secret, String otp)

Creates an assertion for completing the enrollment flow.

Parameters
secret obtained from the generateSecret(MultiFactorSession) step.
otp one-time password obtained from the TOTP App.

public static TotpMultiFactorAssertion getAssertionForSignIn (String enrollmentId, String otp)

Creates an assertion for the sign-in flow.

Parameters
enrollmentId identifies the TOTP second factor being used.
otp one-time password obtained from the TOTP App.