Commit graph

27 commits

Author SHA1 Message Date
Aleksi Häkli
93bb73552e
Upgrade CI tooling to use automatic code formatting 2019-09-28 19:28:17 +03:00
Aleksi Häkli
eb43ab4151
Remove tests for get_version 2019-08-30 07:00:55 +03:00
Aleksi Häkli
a151b9c8e2 Add tests for AXES_ENABLED flag 2019-05-19 18:32:40 +03:00
Aleksi Häkli
3152b4d7e9 Improve lockout and request handling
The old architecture used exceptions in the signal handler
which prevented transactions from running smoothly
and signal handlers from running after Axes handlers.

The new architecture changes the request approach to request flagging
and moves the exception handling into the middleware call method.

This allows users to more flexibly run their own signal handlers
and optionally use the Axes middleware if they want to do so.

Fixes #440
Fixes #442
2019-05-19 18:32:40 +03:00
Aleksi Häkli
30184e2e52
Fix regression with empty IP addresses
Cache backend threw an error with OAuth2 backends
missing IP address in the cache key generation.

Fixes #437
2019-05-09 19:08:18 +03:00
Aleksi Häkli
b46e7cce01
Drop Python 3.5 support
Most of our users are already running on Python 3.6+
and dropping 3.5 and below in a future oriented release
allows us to focus on implementing more readable codebases.

Fixes #417

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-03-09 21:49:45 +02:00
Aleksi Häkli
3bece1aaaa
Set Axes request attributes in middleware
Fixes #415

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-03-03 22:13:13 +02:00
Aleksi Häkli
ff6cb8bffd
Move utils to helpers module
In order to offer backwards compatible import path for the
axes.utils.reset function it has to have a separate
implementation that can be imported independently from
the axes.helpers functions that are used by the
AxesBaseHandler implementation.

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-25 22:54:40 +02:00
Aleksi Häkli
46fc538193
Add cache handler and refactor tests
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-23 20:19:37 +02:00
Aleksi Häkli
e69d479f6a
Refactor handlers to a more pluggable format
- Define a base handler API with method signatures
- Move proxy handler to a separate path for importability
- Implement a database handler with clean external dependencies
- Change the authentication backend and decorators to use the authentication backend

This enables clean pluggable authentication backend definitions that users
can override and specialize with e.g. cached handlers in their own packages.

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-22 19:55:57 +02:00
Aleksi Häkli
a4c4ba6fb7
Refactor utils and attempts internal API
Clean up internal implementations and tests while keeping the
APIs as similar as possible where feasible.

The goal of this change is to not change any documented
or stable APIs that might be in use by users, but to improve
the internal implementations for maintainability and usability.

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-22 19:55:41 +02:00
Aleksi Häkli
bc24d12975
Add support for string type AXES_USERNAME_CALLABLE
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-22 19:55:39 +02:00
Aleksi Häkli
42fe9c15fa
Unify import styling to use from ... imports 2019-02-13 14:05:24 +02:00
Aleksi Häkli
6240b20793
Clean up utils tests for get_client_username 2019-02-12 23:44:35 +02:00
Aleksi Häkli
40a0eae647
Improve tests
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-12 23:22:52 +02:00
Aleksi Häkli
0b6d84762a
Remove deprecated Six usages
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-10 21:47:02 +02:00
Aleksi Häkli
fcef40748a
Deprecate old signature for AXES_USERNAME_CALLABLE and update documentation
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-07 22:09:21 +02:00
Aleksi Häkli
715dedc069
Use PEP257 compliant docstrings
Unify docstring representations based on PEP 257

https://www.python.org/dev/peps/pep-0257/

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-07 18:42:54 +02:00
Aleksi Häkli
030810df79
Drop Python 2.7 and Python 3.4 support
Fixes #395

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-07 17:28:26 +02:00
Aleksi Häkli
d33a55b927
Use single quotes for strings
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-03 16:03:30 +02:00
Aleksi Häkli
8ab4ce228f
Add tests for faulty AXES_USERNAME_CALLABLEs 2018-12-23 04:21:57 +02:00
Aleksi Häkli
becc61818f
Add another test case for AXES_USERNAME_CALLABLE
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2018-12-23 04:02:17 +02:00
Aleksi Häkli
7c3e21166e
Backwards compatibility fixes for credentials
Revert some of the PR changes to tests to make sure that all of the
old format function invocations work with the old and new tests.

Implement small enchancements to documentation and credentials resolving
for usability and flexibility with custom authentication backends.

Update documentation to indicate that backwards compatibility
is supported as well as the new format credentials invocations.

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2018-12-23 02:58:53 +02:00
Benedikt Bauer
306dd3c596 Use credentials whenever possible in favor of request.POST 2018-12-19 15:05:09 +01:00
jd
4684a1a04f Add a setting to supply a callable that can return a correct username given a request object #318 2018-05-22 14:54:45 -07:00
Aleksi Häkli
df8feb4f69
Backport unicode string literals for Python 2.7
Fixes #328
2018-04-18 15:21:09 +03:00
Camilo Nova
ba37442252 Added support for Django signals, big code refactor and improvements 2017-11-17 17:15:34 -05:00