Skip to main content

Django-Rest-Durin

django-rest-durin on pypi Build Status codecov CodeFactor Language grade: Python

Per API client token authentication Module for Django REST Framework.

The idea is to provide one library that does token auth for multiple Web/CLI/Mobile API clients (i.e. devices/user-agents) via one interface but allows different token configuration for each client.

Durin authentication is token based, similar to the TokenAuthentication built in to DRF. However, it adds some extra sauce:

  • Durin allows multiple tokens per user. But only one token each user per API client.
  • Each user token is associated with an API Client.
    • These API Clients are configurable via Django's Admin Interface.
    • Includes permission enforcing to allow only specific clients to make authenticated requests to certain APIViews or vice-a-versa.
    • Configure Rate-Throttling per User <-> Client pair.
  • Durin provides an option for a logged in user to remove all tokens that the server has - forcing them to re-authenticate for all API clients.
  • Durin tokens can be renewed to get a fresh expiry.
  • Durin provides a CachedTokenAuthentication backend as well which uses memoization for faster look ups.
  • Durin provides Session Management features. Refer to Session Management Views i.e.,
    • REST view for an authenticated user to get list of sessions (in context of django-rest-durin, this means AuthToken instances) and revoke a session. Useful for pages like "View active browser sessions".
    • REST view for an authenticated user to get/create/delete token against a pre-defined client. Useful for pages like "Get API key" where a user can get an API key to be able to interact directly with your project's RESTful API using cURL or a custom client.

More information can be found in the Documentation. I'd also recommend going through the example_project/ included in this repository.

Django Compatibility Matrix

PyPi versions - Python

If your project uses an older verison of Django or Django Rest Framework, you can choose an older version of this project.

This Project Python Version Django Version Django Rest Framework
0.1+ 3.5 - 3.10 2.2, 3.0, 3.1, 3.2, 4.0 3.7>=

Make sure to use at least DRF 3.10 when using Django 3.0 or newer.

Changelog / Releases

All releases should be listed in the releases tab on GitHub.

See CHANGELOG for a more detailed listing.

License

This project is published with the MIT License. See https://choosealicense.com/licenses/mit/ for more information about what this means.

Credits

Durin is inpired by the django-rest-knox and django-rest-multitokenauth libraries and adopts some learnings and code from both.

Metadata

Release files for django-rest-durin 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-rest-durin 1.1.0
File Size Uploaded
django-rest-durin-1.1.0.tar.gz 16.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-rest-durin 1.1.0
File Interpreter ABI Platform
django_rest_durin-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.6 kB

Release files / django-rest-durin-1.1.0.tar.gz

Download URL django-rest-durin-1.1.0.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
64e9f1706a6efc3de699ab0808990120228747c18d5826016cd05f37984e2776
BLAKE2b-256 checksum
How to use checksums
6ac5e8d205105b8d7447b265e2839330c3430ef321efc66c275aef9a13ca36ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / django_rest_durin-1.1.0-py3-none-any.whl

Download URL django_rest_durin-1.1.0-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f48e77b29a0b35e128ca6f35cb22941bfee8559dfb75f5bc7e81c893a4c5b8d
BLAKE2b-256 checksum
How to use checksums
5da4395516bdb90c4da6c1979f7aba61ef7d4bf33c915302d8dbd4a44d3bde6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page