Custom integration for django-otp package
Project description
Zweifach
========
Zweifach (german for "two times") is an app to make integration of django-otp a bit more biased.
Integration of two factor auth is enforced by a middleware which will ensure two things:
- make sure a user who is required to enable 2FA for its account will be redirected to the setup-view until setup is done.
- make sure a user who has 2FA enabled will be redirected to verify-view for token input after login until verified.
Quickstart
----------
- Add 'zweifach' to INSTALLED_APPS.
- Add 'zweifach.middleware.ZweifachMiddleware' to MIDDLEWARE, *after' AuthenticationMiddleware.
- Inlcude 'zweifach.urls' somewhere in your url-config.
- Install 'django-otp' from PyPI and configure as described further down below
- Install 'qrcode' from PyPI to make QR-codes from django-otp work as expected
Settings
--------
settings.ZWEIFACH_AUTH_REQUIRED
default: []
A list of checks which determines, if a user needs 2FA to use its account.
examaple:
ZWEIFACH_AUTH_REQUIRED = [
lambda user: user.is_staff, # all staff unsers must use two factor auth
lambda user: '2fa' in user.groups.values_list("name", flat=True), # all users in group '2fa' must use two factor auth
]
settings.ZWEIFACH_URL_EXCLUDES
default: []
A list of url which are always accessible without 2FA.
Verify and Setup views are always excluded as well as settings.LOGIN_URL and the admin login view, if admin is enabled.
example:
ZWEIFACH_URL_EXCLUDES = [
'/imprint/',
'/faq/how-to-setup-2fa/',
]
Notes about django-otp configuration
------------------------------------
A compatible installation of django-otp should be setup as follows:
Add to INSTALLED_APPS:
'django_otp',
'django_otp.plugins.otp_totp',
'django_otp.plugins.otp_static',
Add to MIDDLEWARE (between AuthenticationMiddleware and ZweifachMiddleware):
'django_otp.middleware.OTPMiddleware'
Usage
-----
To generate static recovery tokens (also useful for first login on freshly installed systems) use::
./manage.py addstatictoken <username>
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
zweifach-1.0.tar.gz
(6.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zweifach-1.0.tar.gz.
File metadata
- Download URL: zweifach-1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2f7c80d0d5c01b655249482e40c855ce7126b03b319932984db9e95ca088a18
|
|
| MD5 |
1fe691f73292fe8f5c66b049c945ca5a
|
|
| BLAKE2b-256 |
d9b90fc3282c2619e4066699fa692661668d894a39b0b1acdfde7dd68766b88a
|
File details
Details for the file zweifach-1.0-py3-none-any.whl.
File metadata
- Download URL: zweifach-1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cced30d8e05ceaf7390d619e4de804be7adc3c973a89d7c9c161615e7ff4c067
|
|
| MD5 |
545e4e9709cc66591888fed7750134e4
|
|
| BLAKE2b-256 |
645a401107b5ec82619e4f21d82dde258bb55f4f4dd2f21a9da70589237f67b4
|