DRF Access Key
A library that provides a simple Access Key & Secret Key authorization for Django REST framework.
Requirements
- Python 3.6+
- Django 2.X+
- Django REST framework 3.X+
Install
pip install drf-access-key
✨🍰✨
Or you can use pip install git+https://github.com/ZhaoQi99/drf-access-key.git install latest version.
Quick Start
- Add
rest_framework_access_keytoINSTALLED_APPSsetting:
INSTALLED_APPS = [
...,
'rest_framework_access_key',
]
- Add
AccessKeyAuthenticationtoDEFAULT_AUTHENTICATION_CLASSESsetting located at settings.py from your project:
REST_FRAMEWORK = {
...,
'DEFAULT_AUTHENTICATION_CLASSES': (
...,
'rest_framework_access_key.authentication.AccessKeyAuthentication',
),
}
- Custom
authentication_classesin Django REST framework APIView:
from rest_framework import generics,permissions
from rest_framework.response import Response
from rest_framework_access_key.authentication import AccessKeyAuthentication
class TestViewSet(generics.GenericAPIView):
authentication_classes = (AccessKeyAuthentication,)
permission_classes = (permissions.IsAuthenticated,)
def get(self, request, *args, **kwargs):
return Response({"Hello": "World!"})
How to use
Authentication Method Document 🇨🇳
GET /api/v1/user/ HTTP/1.1
Auth-Access-Key: XXXXXXXX
Auth-Nonce: 83a1ca5507564efd891ad8d6e04529ee
Auth-Timestamp: 1677636324
Content-Type: application/json
Auth-Signature: XXXXXXX
Settings
Settings are configurable in settings.py in the scope ACCESS_KEY_SETTINGS. You can override any setting, otherwise the defaults below are used.
ACCESS_KEY_DEFAULTS: Dict[str, Any] = {
"NONCE_CACHE_PREFIX": "OpenAPI",
"NONCE_CACHE_TTL": 5,
"TIMESTAMP_ERROR_RANGE": 10 * 60,
}
License
GNU General Public License v3.0
Author
- Qi Zhao(zhaoqi99@outlook.com)
Metadata
Release files for drf-access-key 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| drf-access-key-0.1.0.tar.gz | 18.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drf_access_key-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.8 kB
Release files / drf-access-key-0.1.0.tar.gz
| Download URL | drf-access-key-0.1.0.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5408c1b6c17f1cd4fa0f5478767d965e3f4db7e938b6b78f641acd8da8801e87
|
|
BLAKE2b-256 checksum How to use checksums |
b685493473ecf30b2ad9f084dca702bb404a2cbdb74e004676cb56db391cb783
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13
|
Release files / drf_access_key-0.1.0-py3-none-any.whl
| Download URL | drf_access_key-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
138daac5c6e3902394966ebe8d791cbfd96173b14a1d4e96698579c6f8f992fd
|
|
BLAKE2b-256 checksum How to use checksums |
7caba0e430a533102f0caa3c7a1b2e5715e788836eb8d0807de5d150e3a7063a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13
|
Security for drf-access-key 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.