HomePhabricator

Allow different MFA factor types (SMS, TOTP, Duo, ...) to share "sync" tokens…

Description

Allow different MFA factor types (SMS, TOTP, Duo, ...) to share "sync" tokens when enrolling new factors

Summary:
Depends on D20019. Ref T13222. Currently, TOTP uses a temporary token to make sure you've set up the app on your phone properly and that you're providing an answer to a secret which we generated (not an attacker-generated secret).

However, most factor types need some kind of sync token. SMS needs to send you a code; Duo needs to store a transaction ID. Turn this "TOTP" token into an "MFA Sync" token and lift the implementation up to the base class.

Also, slightly simplify some of the HTTP form gymnastics.

Test Plan:

  • Hit the TOTP enroll screen.
  • Reloaded it, got new secrets.
  • Reloaded it more than 10 times, got told to stop generating new challenges.
  • Answered a challenge properly, got a new TOTP factor.
  • Grepped for removed class name.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13222

Differential Revision: https://secure.phabricator.com/D20020