A Django package for JSON Web Token validation and verification. Using PyJWT.
Project description
===== Django-JWT
This is a package to verify and validate JSON Web Tokens (JWT) in Django.
Installation
-
Install the package using pip.
-
Add "django_jwt" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...
'django_jwt',
]
Configuration:
Required variables:
- JWT_CERTS_URL - certificate endpoint, like
https://keyCloak/realms/h/protocol/openid-connect/certs
Optional variables:
-
JWT_ALGORITHM - by default
ES256
-
JWT_AUDIENCE - by default ["account", "broker"]
-
JWT_USER_UID - User model' unique identifier, by default
kc_id
-
JWT_USER_MAPPING - mapping between JWT claims and user model fields, by default:
JWT_USER_MAPPING = {
'first_name': 'first_name',
'last_name': 'last_name',
'username': 'username',
}
- JWT_USER_DEFAULTS - default values for user model fields, by default:
JWT_USER_DEFAULTS = {
'is_active': True,
}
- JWT_USER_ON_CREATE and JWT_USER_ON_UPDATE - functions to be called on user creation and update, by default:
JWT_USER_ON_CREATE = None
JWT_USER_ON_UPDATE = None
Testing:
Run command python runtests.py
to run tests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dj-jwt-auth-0.1.1.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for dj_jwt_auth-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83fca0a5a5f4be088175c1e4abe0d641a1b8b053fcf8a94d71a75146561a80e8 |
|
MD5 | 6b0be2c9ed8a23165070f01d30b277d8 |
|
BLAKE2b-256 | 89dda2c167f58fb5db2c00def888c5a9e90a0a48d8560a5ae90f9391005fc113 |