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.5.0.tar.gz
.
File metadata
- Download URL: exceptional_auth-0.5.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.10.1 urllib3/1.26.7 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44488de19aff299d5fc3cc54dfb101127c265f13637b731bc32bb40d2f5b50ca |
|
MD5 | 6186136d7182dad95033351546a1cb1e |
|
BLAKE2b-256 | 33351160ed8e0769f73911028fa928e7c9d9443361c966742532b1286d034e85 |
File details
Details for the file exceptional_auth-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: exceptional_auth-0.5.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.10.1 urllib3/1.26.7 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dbc2a7964179e3b5ac14ca43b33e725fc1070191df4ca46d984c71979d2b30a |
|
MD5 | 749280e34ba91c7cac096e0230584619 |
|
BLAKE2b-256 | 933a89f4496f836177c4e1f05623bc29facc46ddf3e1fadabeec989ab149584d |