Skip to main content

Logout users when the passwords changed in REST API

Project description

Django Auth Protection

Django Auth Protection This package logout users from the system by changing the password in REST API.


Why Django Auth Protection?

Simple JWT provides a JSON Web Token authentication backend for the Django REST Framework. It aims to cover the most common use cases of JWTs by offering a conservative set of default features. It also aims to be easily extensible in case a desired feature is not present. But one of the problems is that when the users change the password, they can continue to work on the system with the previous token until it expires. This package overrides the Simple JWT to solve this problem.


How to use it


  • Download and install latest version of Django Auth Protection:
$ pip install django-auth-protection
# or
$ easy_install django-auth-protection

Then you have to create a custom TokenObtainPairView class and change the serializer_class to ProtectTokenObtainPairSerializer (follow the sample):

  • Make a custom TokenObtainPairView and change the serializer_class:
from auth_protection.serializers import ProtectTokenObtainPairSerializer


class CustomTokenObtainPairView(TokenObtainPairView):

    serializer_class = ProtectTokenObtainPairSerializer
  • Change All authentication_classes on your views and replace it with JWTAuthProtection:
from auth_protection.authentications import JWTAuthProtection


class SampleView(TARGET_VIEW):
    authentication_classes = [JWTAuthProtection]

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

django-auth-protection-1.0.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

django_auth_protection-1.0.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file django-auth-protection-1.0.3.tar.gz.

File metadata

  • Download URL: django-auth-protection-1.0.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.7.1 requests/2.22.0 setuptools/58.2.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for django-auth-protection-1.0.3.tar.gz
Algorithm Hash digest
SHA256 043b489303ef495f9d84e1fc000517b92e00118449d6a79c11e0fd8c8410d201
MD5 8cd9281c7ebac104162c04e1415b3f65
BLAKE2b-256 a19688b3c75fc0fd2887ef7ad4033af5c6ff9fb62cf04c6b5a7be9fae4e7aa5e

See more details on using hashes here.

File details

Details for the file django_auth_protection-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: django_auth_protection-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.7.1 requests/2.22.0 setuptools/58.2.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for django_auth_protection-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7e732c5b9fb0674fdd2b13ee363cf2cddd2e680f5895a36d9494c560b20cb6c4
MD5 b6b2ade52991e1d374ef91ef4a0a7033
BLAKE2b-256 0e125956203be6e5954e2e8974609384a8415622b9b810be777389968a94a73a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page