This project has been archived by its maintainers, and is no longer receiving any updates.
REST framework JWT Auth (FORK)
Added a possibility to use custom User model. So that it is possible have several User models at the same project and keep authentication flow separately from each other.
Recipe
Extend `rest_framework_jwt.authentication.JSONWebTokenAuthentication` and define which user model it should use.
from rest_framework_jwt import authentication class MyJWTAuthentication(authentication.JSONWebTokenAuthentication): user_model = 'some_app.SomeUserModel'Define views that manipulate the token and tell them which user model to use. e.g.:
from rest_framework_jwt.views import ObtainJSONWebToken, RefreshJSONWebToken obtain_jwt_token = ObtainJSONWebToken.as_view(user_model='some_app.SomeUserModel') urlpatterns = router.urls + [ url(r'^api-token-auth/', obtain_jwt_token, name='auth-jwt-get'), ]Use your authentication class in your views.
class TestView(ViewSet): authentication_classes = (MyJWTAuthentication, )
If you don’t want to use default `django.contrib.auth.authenticate` which is using backends defined at `settings.AUTHENTICATION_BACKENDS` for all users, you need to write your own authentication handler and tell `JSONWebTokenSerializer` to use it by overriding `JSONWebTokenSerializer.authenticate` method.
class MyJWTSerializer(serializers_jwt.JSONWebTokenSerializer): def authenticate(self, **credentials): return my_authenticate(**credentials) # your obtain token view then will look like this obtain_jwt_token = ObtainJSONWebToken.as_view( user_model='some_app.SomeUserModel', serializer_class=MyJWTSerializer ) urlpatterns = router.urls + [ url(r'^api-token-auth/', obtain_jwt_token, name='auth-jwt-get'), ]
REST framework JWT Auth
JSON Web Token Authentication support for Django REST Framework
Full documentation for the project is available at docs.
Overview
This package provides JSON Web Token Authentication support for Django REST framework.
If you want to know more about JWT, check out the following resources:
Requirements
Python (2.7, 3.3, 3.4, 3.5)
Django (1.8, 1.9, 1.10, 1.11)
Django REST Framework (3.1, 3.2, 3.3, 3.4, 3.5, 3.6)
Installation
Install using pip…
$ pip install djangorestframework-jwt
Documentation & Support
Full documentation for the project is available at docs.
You may also want to follow the author on Twitter.
Metadata
Release files for djangorestframework-jwt-custom-user 1.11.1
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 | Actions |
|---|---|---|---|---|
| djangorestframework-jwt-custom-user-1.11.1.tar.gz | 10.9 kB | Without provenance | Details for djangorestframework-jwt-custom-user-1.11.1.tar.gz |
Release files / djangorestframework-jwt-custom-user-1.11.1.tar.gz
| Download URL | djangorestframework-jwt-custom-user-1.11.1.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1679a68010d43f687431a2f0ec2397cc24a2ca650a46f7acd2723e87ccb98d14
|
|
BLAKE2b-256 checksum How to use checksums |
f821ca74ee4648712e4bf9b38005bf5fea7eb4171bf6b434ffd8d04ec9cf4dde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for djangorestframework-jwt-custom-user 1.11.1
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.