WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 73b7593

Browse files
authored
Add missing settings documentation (#952)
Document 8 missing settings from DEFAULTS in settings.rst, including JSON_ENCODER, CHECK_USER_IS_ACTIVE, and serializer options. related issue: #654 related PR: #668, #521, #834, #568
1 parent ed72f14 commit 73b7593

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

docs/settings.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Some of Simple JWT's behavior can be customized through settings variables in
5353
"TOKEN_BLACKLIST_SERIALIZER": "rest_framework_simplejwt.serializers.TokenBlacklistSerializer",
5454
"SLIDING_TOKEN_OBTAIN_SERIALIZER": "rest_framework_simplejwt.serializers.TokenObtainSlidingSerializer",
5555
"SLIDING_TOKEN_REFRESH_SERIALIZER": "rest_framework_simplejwt.serializers.TokenRefreshSlidingSerializer",
56+
57+
"CHECK_REVOKE_TOKEN": False,
58+
"REVOKE_TOKEN_CLAIM": "hash_password",
59+
"CHECK_USER_IS_ACTIVE": True,
5660
}
5761
5862
Above, the default values for these settings are shown.
@@ -175,6 +179,12 @@ integer for seconds or a ``datetime.timedelta``. Please reference
175179
https://pyjwt.readthedocs.io/en/latest/usage.html#expiration-time-claim-exp
176180
for more information.
177181

182+
``JSON_ENCODER``
183+
----------------
184+
185+
A custom JSON encoder class to use when encoding JWT tokens. When set to
186+
``None``, the default JSON encoder is used. This is useful if you need to
187+
serialize non-standard types in your token claims.
178188

179189
``AUTH_HEADER_TYPES``
180190
---------------------
@@ -303,3 +313,52 @@ payload of the JWT token.
303313
The claim name that is used to store a user hash password.
304314
If the value of this CHECK_REVOKE_TOKEN field is ``True``, this field will be
305315
included in the JWT payload.
316+
317+
``CHECK_USER_IS_ACTIVE``
318+
------------------------
319+
320+
When set to ``True`` (the default), the authentication will check if the user's
321+
``is_active`` flag is ``True``. If the user is inactive (``is_active=False``),
322+
authentication will fail with a 401 status code. Set this to ``False`` if you
323+
want to allow inactive users to authenticate with valid tokens.
324+
325+
This setting affects both token authentication via ``JWTAuthentication`` and
326+
the login validation via ``USER_AUTHENTICATION_RULE``.
327+
328+
``TOKEN_OBTAIN_SERIALIZER``
329+
---------------------------
330+
331+
A dot path to the serializer class used by ``TokenObtainPairView``.
332+
This can be customized to include additional claims or modify the
333+
token generation logic.
334+
335+
``TOKEN_REFRESH_SERIALIZER``
336+
----------------------------
337+
338+
A dot path to the serializer class used by ``TokenRefreshView``.
339+
Customize this to modify refresh token handling behavior.
340+
341+
``TOKEN_VERIFY_SERIALIZER``
342+
---------------------------
343+
344+
A dot path to the serializer class used by ``TokenVerifyView``.
345+
Customize this to modify token verification behavior.
346+
347+
``TOKEN_BLACKLIST_SERIALIZER``
348+
------------------------------
349+
350+
A dot path to the serializer class used by ``TokenBlacklistView``.
351+
Requires the ``rest_framework_simplejwt.token_blacklist`` app to be
352+
installed.
353+
354+
``SLIDING_TOKEN_OBTAIN_SERIALIZER``
355+
-----------------------------------
356+
357+
A dot path to the serializer class used by ``TokenObtainSlidingView``.
358+
For use with sliding tokens feature.
359+
360+
``SLIDING_TOKEN_REFRESH_SERIALIZER``
361+
------------------------------------
362+
363+
A dot path to the serializer class used by ``TokenRefreshSlidingView``.
364+
For use with sliding tokens feature.

0 commit comments

Comments
 (0)