Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Alan Crosswell
Aleksander Vaskevich
Alessandro De Angelis
Allisson Azevedo
Andrew Chen Wang
Anvesh Agarwal
Aristóbulo Meneses
Aryan Iyappan
Expand Down
19 changes: 4 additions & 15 deletions oauth2_provider/views/introspect.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import calendar
import json

from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse
from django.http import JsonResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt

Expand All @@ -29,9 +28,7 @@ def get_token_response(token_value=None):
get_access_token_model().objects.select_related("user", "application").get(token=token_value)
)
except ObjectDoesNotExist:
return HttpResponse(
content=json.dumps({"active": False}), status=401, content_type="application/json"
)
return JsonResponse({"active": False}, status=401)
else:
if token.is_valid():
data = {
Expand All @@ -43,17 +40,9 @@ def get_token_response(token_value=None):
data["client_id"] = token.application.client_id
if token.user:
data["username"] = token.user.get_username()
return HttpResponse(content=json.dumps(data), status=200, content_type="application/json")
return JsonResponse(data)
else:
return HttpResponse(
content=json.dumps(
{
"active": False,
}
),
status=200,
content_type="application/json",
)
return JsonResponse({"active": False})

def get(self, request, *args, **kwargs):
"""
Expand Down