django-axes/docs/migration.rst
Aleksi Häkli 99175dc57f
Use middleware, backends, and signals for lockouts
Fixes #389

Remove monkey-patching from the application loader phase
and use the Django authentication stack for lockout signals.

Utilize custom AUTHENTICATION_BACKENDS and MIDDLEWARE with signals
with backwards compatible implementation of features.

Update documentation, configuration and migration instructions
to match the new configuration and improve the code commentation.

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-03 16:03:30 +02:00

35 lines
1.5 KiB
ReStructuredText

.. _migration:
Migration
=========
This page contains migration instructions between different django-axes
versions so that users might more confidently upgrade their installations.
From django-axes version 4 to version 5
---------------------------------------
Application version 5 has a few differences compared to django-axes 4.
You might need to search your own codebase and check if you need to change
API endpoints or names for compatibility reasons.
- Login and logout view monkey-patching was removed.
Login monitoring is now implemented with signals
and locking users out is implemented with a combination
of a custom authentication backend, middlware, and signals.
- ``AxesModelBackend`` was renamed to ``AxesBackend``
for better naming and preventing the risk of users accidentally
upgrading without noticing that the APIs have changed.
Documentation was improved. Exceptions were renamed.
- ``axes.backends.AxesModelBackend.RequestParameterRequired``
exception was renamed, retyped to ``ValueError`` from ``Exception``, and
moved to ``axes.exception.AxesBackendRequestParameterRequired``.
- ``AxesBackend`` now raises a
``axes.exceptions.AxesBackendPermissionDenied``
exception when user is locked out which triggers signal handler
to run on failed logins, checking user lockout statuses.
- Axes lockout signal handler now raises exception
``axes.exceptions.AxesSignalPermissionDenied`` on lockouts.
- ``AxesMiddleware`` was added to return lockout responses.
The middleware handles ``axes.exception.AxesSignalPermissionDenied``.