Skip to content

Commit e5baf6a

Browse files
Verify should check if token_blacklist installed (jazzband#450)
* Verify should check if token_blacklist installed * Add missing import
1 parent 4b962cc commit e5baf6a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rest_framework_simplejwt/serializers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django.conf import settings
12
from django.contrib.auth import authenticate, get_user_model
23
from django.contrib.auth.models import update_last_login
34
from django.utils.translation import gettext_lazy as _
@@ -147,7 +148,10 @@ class TokenVerifySerializer(serializers.Serializer):
147148
def validate(self, attrs):
148149
token = UntypedToken(attrs['token'])
149150

150-
if api_settings.BLACKLIST_AFTER_ROTATION:
151+
if (
152+
api_settings.BLACKLIST_AFTER_ROTATION
153+
and 'rest_framework_simplejwt.token_blacklist' in settings.INSTALLED_APPS
154+
):
151155
jti = token.get(api_settings.JTI_CLAIM)
152156
if BlacklistedToken.objects.filter(token__jti=jti).exists():
153157
raise ValidationError("Token is blacklisted")

0 commit comments

Comments
 (0)