deux.abstract_models¶
-
class
deux.abstract_models.
AbstractMultiFactorAuth
[source]¶ This abstract class holds user information, MFA status, and secret keys for the user.
-
CHALLENGE_CHOICES
= ((u'sms', u'SMS'), (u'', u'Off'))¶ Different status options for this MFA object.
-
backup_code
¶ Returns the users backup code.
-
backup_key
¶ Secret key used for backup code.
-
challenge_type
¶ Challenge type used for MFA.
-
check_and_use_backup_code
(code)[source]¶ Checks if the inputted backup code is correct and disables MFA if the code is correct.
This method should be used for authenticating with a backup code. Using a backup code to authenticate disables MFA as a side effect.
-
disable
()[source]¶ Disables MFA for this user.
The disabling process includes setting the objects challenge type to DISABLED, and removing the backup_key and phone_number.
-
enable
(challenge_type)[source]¶ Enables MFA for this user with the inputted challenge type.
The enabling process includes setting this objects challenge type and generating a new backup key.
Parameters: challenge_type – Enable MFA for this type of challenge. The type must be in the supported CHALLENGE_TYPES. Raises: AssertionError – If challenge_type
is not a supported challenge type.
-
enabled
¶ Returns if MFA is enabled.
-
get_bin_key
(challenge_type)[source]¶ Returns the key associated with the inputted challenge type.
Parameters: challenge_type – The challenge type the key is requested for. The type must be in the supported CHALLENGE_TYPES. Raises: AssertionError – If challenge_type
is not a supported challenge type.
-
phone_number
¶ User’s phone number.
-
refresh_backup_code
()[source]¶ Refreshes the users backup key and returns a new backup code.
This method should be used to request new backup codes for the user.
-
sms_bin_key
¶ Returns binary data of the SMS secret key.
-
sms_secret_key
¶ Secret key used for SMS codes.
-
user
¶ User this MFA object represents.
-