Flexible authentication for web, mobile, desktop and hybrid apps. It can be used for 1fa, 2fa and mfa cases.
Project description
Django Multifactor Authentication
Flexible authentication for web, mobile, desktop and hybrid apps. It can be used for 1fa, 2fa and mfa cases. Easily configurable and extendable with new authentication methods or services. Authenticaton scenarios, called flows
, are based on identifiers
and secrets
, which can be used or not used in multiple combinations:
- username, email, phone, ...
- password, passcode (one-time pass or token), hardcode (device or card id), ...
and service providers:
- Twilio
- SendGrid (to be specified)
- Nexmo (to be done)
- Amazon SNS (to be done)
- ...add yours
Usage
The package creates custom user model, that could be used as is or as inherited. General priniciples for custom user models in Django are respected (how it works).
Base settings (required):
AUTH_USER_MODEL = 'multauth.User'
AUTHENTICATION_BACKENDS = (
'multauth.backends.ModelBackend',
# ...etc
)
MULTAUTH_FLOWS = (
('phone', 'hardcode', 'passcode',),
('email', 'password', 'passcode',),
('username', 'password',),
# ...etc
)
Extra settings (optional):
(see built-in devices, providers and templates)
MULTAUTH_DEVICES = [
UsernameDevice,
EmailDevice,
PhoneDevice,
] # by default
MULTAUTH_DEBUG = True # False by default
MULTAUTH_PASSCODE_LENGTH = 6 # size in digits
MULTAUTH_PASSCODE_EXPIRY = 3600 # time in seconds
MULTAUTH_DEVICE_EMAIL_PROVIDER = 'mail' # by default
MULTAUTH_DEVICE_PHONE_PROVIDER = 'twilio' # by default
MULTAUTH_DEVICE_EMAIL_TEMPLATE_NAME = 'custom'
MULTAUTH_DEVICE_EMAIL_VERIFICATION_VIEWNAME = 'custom'
MULTAUTH_DEVICE_PHONE_TEMPLATE_NAME = 'custom'
Provider specific settings (could be required):
MULTAUTH_PROVIDER_TWILIO_ACCOUNT_SID = 'SID'
MULTAUTH_PROVIDER_TWILIO_AUTH_TOKEN = 'TOKEN'
MULTAUTH_PROVIDER_TWILIO_CALLER_ID = 'CALLER_ID'
Usage more
Custom use cases and how to config or code them.
User activation
Users are set as "active" on creation. This behavior is not managed by settings for now (check for further updates).
Devices verification
By default all devices are set as "confirmed" on creation. To change this behavior extra settings should be added, for example:
MULTAUTH_DEVICE_EMAIL_CONFIRMED = False
MULTAUTH_DEVICE_PHONE_CONFIRMED = False
...
Non-comfirmed devices will automatically be called for verification (token/key to be sent) on creation or idenfier updates. To invoke verification manually, call api endpoints:
multauth:signup-verification
or model methods:
user.verify
for all non-confirmed devicesuser.verify_email
for emailuser.verify_phone
for phone- ...
And to complete verification process call api endpoints:
multauth:signup-verification-phone
to post the tokenmultauth:signup-verification-email
to post the tokenmultauth:signup-verification-email-key
as a classic in-email link to pass the key- ...
or model methods:
user.verify_phone_token
user.verify_email_token
user.verify_email_key
- ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-multifactor-authentication-0.9.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa7d8533ba1ae2c0f3b6d0f7e6dc6484e28aebd69d3fe1f6f5cfd9dc3cfaabed |
|
MD5 | 18b60c2fa39bc5b8f7e57e52b136e67a |
|
BLAKE2b-256 | 1f8a2a044194257892f086f32c0cda58ba12e66d8c6458c798192ad72ef2d636 |
Hashes for django_multifactor_authentication-0.9.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f214a672867e59c688e92fbb82ab12658ac1fc6794adb600ed231e42f4d989fa |
|
MD5 | 0460d5599cc685653e3f3764a27cd1bf |
|
BLAKE2b-256 | ea5c03b146c29168f2839fe5d7f900b2c7a1e51018825139ac8e94829fad7214 |