Exception-based authentication helpers for django
Project description
exceptional_auth
The purpose of this package is to provide a more flexible/powerful replacement for Django's login_required
and permission_required
decorators (and provide some entirely new related functionality).
The idea is to create a standard set of exceptions which any code can raise (even reusable apps distributed on pypi), and leave the handling of these exceptions up to the site developer (via custom middleware). This makes the many per-view decisions easy (ie. just raise PermissionDenied), while letting you centralize/delay the decision of what to do in those situations. Since you have access to the request object in the middleware methods, you can easily tailor the handling of these exceptions base on section of site, request type, etc.
We provide exceptional_auth.BaseMiddleware
, a Middleware base class which makes it easier to handle our exceptions. Site developers should write a custom middleware extending this class, and add to MIDDLEWARE
setting. You can also use exceptional_auth.BaseMiddleware
to start with, and then extend it later.
Project details
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
File details
Details for the file exceptional_auth-0.3.0.tar.gz
.
File metadata
- Download URL: exceptional_auth-0.3.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93aaf55fc27251fcbd759a6a08cbfe60fe4474f23b90c0c90153e12f461a5cca |
|
MD5 | 3957fbde159954584d0a25c7b21a2e30 |
|
BLAKE2b-256 | 1efab40353aa0c7b76c618d3ca15fadc30aded554a29be586c1489272a19f715 |
File details
Details for the file exceptional_auth-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: exceptional_auth-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c1eca9de2245b49c1054528347ca090d1e249715318da091ecc5b6424f91c7c |
|
MD5 | 767aff7ea2eefd552f3188fcf5f044f4 |
|
BLAKE2b-256 | 36c1417c78878743ba550ddf3a46a9ba200fa24691a71e0d60fa72729d85f1fb |