Django application for FIDO protocol
Project description
django-fido
Django application for FIDO protocol
Django-fido provides basic components for FIDO 2 authentication - model to store user's FIDO 2 authenticator data and basic views.
Table of Contents
Dependencies
- Python 3.8 and higher
- Django >= 4.0
Configuration
- Add
django_fidotoINSTALLED_APPS.# <django_project>/settings.py INSTALLED_APPS = [ ... 'django_fido', ]
- Add
django_fido.backends.Fido2AuthenticationBackendtoAUTHENTICATION_BACKENDS.# <django_project>/settings.py AUTHENTICATION_BACKENDS = [ 'django.contrib.auth.backends.ModelBackend', 'django_fido.backends.Fido2AuthenticationBackend', ]
- Link django-fido URLs into your
urls.py:# <django_project>/urls.py urlpatterns += [ path('', include('django_fido.urls')), ]
- If you wish, set string variable
DJANGO_FIDO_RP_NAME.
Extra configuration
DJANGO_FIDO_RESIDENT_KEY
Default: False
Purpose: Set to True to enable discoverable credentials, private key and associated metadata is stored in persistent memory on the authenticator. This is useful for passwordless authentication.
One step authentication
You can also decide to use one step authentication. In this case, you will use just one authentication form, that will collect username, password and FIDO2 credentials. In addition to the configuration above, you also need to:
- Set
DJANGO_FIDO_TWO_STEP_AUTHtoFalse. - Replace
django_fido.backends.Fido2AuthenticationBackendwithdjango_fido.backends.Fido2GeneralAuthenticationBackendinAUTHENTICATION_BACKENDS. - Set
DJANGO_FIDO_AUTHENTICATION_BACKENDSto the list of your additional authentication backends, if you use others thandjango.contrib.auth.backends.ModelBackend. - Set
data-autosubmit-offattribute on the form element of your login page.
Please note that your login form must have a field named username, even if your USERNAME_FIELD is not username.
Metadata download
If you want to be able to download authenticator metadata, you need to set DJANGO_FIDO_METADATA_SERVICE setting which is a dictionary.
The MDS is available in two versions v2 (deprecated) and v3 (current).
If you want to use MDSv2, you have to set a valid ACCESS_TOKEN.
If you want to use MDSv3, you have to set MDS_FORMAT to 3 and set a valid URL providing the MDSv3 data.
Then you can periodically run the download_authenticator_metadata management command.
If metadata are available for the given Authenticator, its metadata property will be an object.
The level, vulnerabilities and is_update_available methods on metadata can be used to determine the trust and certification level.
Passwordless
This authentication requires "discoverable credential" and using that credential to perform a user lookup using the passwordless authentication backend
- Set
DJANGO_FIDO_RESIDENT_KEYtoTrue - Set 'DJANGO_FIDO_PASSWORDLESS_AUTH' to 'True'
- Set 'DJANGO_FIDO_TWO_STEP_AUTH' to 'False'
- Replace
django_fido.backends.Fido2AuthenticationBackendwithdjango_fido.backends.Fido2PasswordlessAuthenticationBackendinAUTHENTICATION_BACKENDS.
Set user verification requirement
Set DJANGO_FIDO_USER_VERIFICATION to required, preferred or discouraged, default is None
Changes
See changelog.
Testing
Use tox to run tests
tox
License
See LICENSE.
Changelog
Unreleased
1.4.0
- Make auth backends async compatible (Django 5.2+ only)
1.3.0
- Removed support for Django 3.0 and 3.1
- Added support for Django 4.2, 5.1 and 5.2
- Added support for Python 3.11 and 3.12
- Upgrade NPM dependencies
1.2.1
- Fixed metadata lookup for devices with device certificate directly in MDS
1.2.0
- Changed redirect after adding authenticator in administration to changelist instead of change view
- Made
user_handlein admin readonly - Upgrade to nodejs 18.x
- Fixed resident key registration
1.1.0
- Add support for fido2 1.1
- Drop support for fido2 < 1.1
- Export js translations for optional modifications
1.0.1
- Pin fido2 dependency
1.0.0
- Add support for fido2 1.0
- Drop support for fido2 < 1.0
- Provide fido2 JS functions without side effects
0.43
- Handle InvalidStateError
- Drop
FIDO_CERTIFIEDfromAUTH_LEVELS
0.42
- Export createTranslations function in fido2.js
0.41
- Fix reversing of the order of statusReports in metadata
0.40
- Pin fido2 to ~= 0.9
- Drop support for Django 2.x
- Fix package build with setuptools-npm
0.39
- Fix uncaught exception when user does not exist
0.38
- Fix Authenticator.metadata if no identifier is present
- Added passwordless auth backend
0.37
- Drop support for Django 1.11
- Drop support for python 3.5
- Sets a default_auto_field
- Fix django.conf.urls deprecation warnings
- Added user_handle field to Authenticator model
- Added DJANGO_FIDO_RESIDENT_KEY (default False) app setting
- Restructured js handling key registration and exposed additional functions
0.36
- Sort users in admin Authenticator add form by username
- Sort statusReport dictionary in metadata
0.35
- Change authenticate request arg to positional
- Fix metadata for empty credential_data
- Bump path-parse from 1.0.6 to 1.0.7
- Proper cleanup of database model under MDS3
0.34
- Fix MDS3 metadata verification
0.33
- Support for MDSv3 AuthenticatorMetadata
0.32
- Fix authentication for devices without counter support
0.31
- Support for
fido2library>0.9.0 - Add tests under django 3.1
- Handle when multiple device metadata are returned
- JS fixes and updates
0.30
- Counter is now stored as BigInteger.
- Restrict version of
fido2library to<0.9.0.
0.29
- Catch
InvalidAttestationerror in registration view.
0.28
- Updated error strings to be more informative.
0.27
- Throw form error on unknown attestation format instead of a server error.
0.26
- Improve metadata matching for U2F authenticators.
0.25
- BREAKING - AuthenticatorMetadata are now looked up by URL and not by an identifier. If you are downloading metadata, you need to clear them all and re-download to prevent multiple objects for each authenticator.
- Update JS dependencies
0.24
- Metadata validation
0.23
- Display no authenticator error
errorkey in repsponse ofBaseFido2RequestViewis now deprecated and will be removed in the future- Added metadata download and reporting
0.22
- Use username as a backup
displayName
0.21
- Create FIDO errors list when needed unless it already exists
- Clear FIDO errors list before each registration or authentication request
0.20
- Fix Django 3.0 compatibility issues in templates
0.19
- Added class attribute
attestation_typestoFido2ViewMixinto specify allowed attestation types during registration. - Set default value of setting
DJANGO_FIDO_AUTHENTICATION_BACKENDSto list containingdjango.contrib.auth.backends.ModelBackend
0.18
- Fix issue caused by default value of
DJANGO_FIDO_AUTHENTICATION_BACKENDS. It is now empty list.
0.17
- BREAKING Replace
Fido2ModelAuthenticationBackendwith more generalFido2GeneralAuthenticationBackend.
0.16
- BREAKING Authenticator
labelhas to be unique for user. This can potentialy break if you have multiple tokens for user. - Add authenticator admin.
- Add one step authentication.
0.15
- Add
DJANGO_FIDO_RP_NAMEsetting. - Add back autosubmit on login view.
- Display error in login view on server request error.
0.14
- Add label to Authenticator model.
- Remove autosubmit on registration view.
- Update JS dependencies.
0.13
- Support fido2 0.6-0.8.
- Add support for python 3.8.
- Fixup annotations.
0.12
- Fix dependencies (add webpack-cli).
0.11
- Fix webpack output path.
0.10
- Fix dependencies (add webpack).
0.9
- Refactor JS code.
- Update setup.
- Add bumpversion.
0.8
- Fix JS translation lazynes.
- For empty values, submit button reload page.
0.7
- Add credential ID field.
- Drop
credential_datafield. - Update error messages.
- Mark django-fido as typed.
- Add JS hooks.
0.6
- Use FIDO 2 instead of U2F.
- Drop python 2.7.
- Add annotations and mypy check.
- Move repository to a CZ.NIC account.
0.5
- Fix JS translation lazynes
0.4
- Update JS messages.
- Drop unused
polintenvironment in tox.
0.3
- Store attestation certificate in database #6
- Install package data #7
0.2
- Accept any arguments in
BaseU2fRequestView.get - Add czech translations
- Fix links in README
0.1
- Initial version
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
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 django_fido-1.4.0.tar.gz.
File metadata
- Download URL: django_fido-1.4.0.tar.gz
- Upload date:
- Size: 152.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0e87e93961f5141fba48c39058177bf9e664accd9819e4d8ace82638eda048f
|
|
| MD5 |
c1a6f5513a3172fe9ffdca3db2a1958a
|
|
| BLAKE2b-256 |
14c3e5f7da7b5f6cd2204cb5129c06ebe131942a37e98292cfea5f4a50c61654
|
File details
Details for the file django_fido-1.4.0-py3-none-any.whl.
File metadata
- Download URL: django_fido-1.4.0-py3-none-any.whl
- Upload date:
- Size: 112.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c06100ad113fd3388b9bb9c4516fb19eb0207a351303e764245130556c25afb
|
|
| MD5 |
0765825da7e00aac74dc25d01119b3be
|
|
| BLAKE2b-256 |
bea132bb6a988df2cdafdf562fd4e2a6a5b8361a69c71733e22a7b6417a3daac
|