Skip to content

Commit aaa9036

Browse files
committed
Additional testing
1 parent c3cf369 commit aaa9036

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

curl-commands.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/token/obtain/ --data '{"username":"djsr","password":"djsr"}'
22
curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/user/create/ --data '{"email":"ichiro@mariners.com","username":"ichiro1","password":"konnichiwa"}'
3-
curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/token/refresh/ --data '{"refresh":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU2MTYyMTg0OSwianRpIjoiYmE3OWUxZTEwOWJkNGU3NmI1YWZhNWQ5OTg5MTE0NjgiLCJ1c2VyX2lkIjoxfQ.S7tDJaaymUUNs74Gnt6dX2prIU_E8uqCPzMtd8Le0VI"}'
3+
curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/token/refresh/ --data '{"refresh":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU4MzMzMDg5MSwianRpIjoiZTZjN2ZjMzMyNzdiNDMwNzgyNGM1MzQyN2U0ZWU2NmYiLCJ1c2VyX2lkIjoxLCJmYXZfY29sb3IiOiJSb3VnZSJ9.acscYBSt57Crm8TAjOkVScjdJ9tPkdeCkr647p6mTqw"}'
44
curl --header "Content-Type: application/json" --header "Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTYwNDI5MTE2LCJqdGkiOiI1NWVlZDA4MGQ2YTg0MzI4YTZkZTE0Mjg4ZjE3OWE0YyIsInVzZXJfaWQiOjIsImZhdl9jb2xvciI6IiJ9.LXqfhFifGDA6Qg8s4Knl1grPusTLX1lh4YKWuQUuv-k" -X GET http://127.0.0.1:8000/api/hello/

djsr/authentication/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from rest_framework_simplejwt.views import TokenObtainPairView
44
from rest_framework.views import APIView
55
from rest_framework_simplejwt.tokens import RefreshToken
6+
from rest_framework_simplejwt.token_blacklist.models import OutstandingToken, BlacklistedToken
67

78
from .serializers import MyTokenObtainPairSerializer, CustomUserSerializer
89

@@ -32,6 +33,8 @@ def get(self, request):
3233

3334

3435
class LogoutAndBlacklistRefreshTokenForUserView(APIView):
36+
permission_classes = (permissions.AllowAny,)
37+
authentication_classes = ()
3538

3639
def post(self, request):
3740
try:
@@ -40,4 +43,4 @@ def post(self, request):
4043
token.blacklist()
4144
return Response(status=status.HTTP_205_RESET_CONTENT)
4245
except Exception as e:
43-
return Response(status=status.HTTP_400_BAD_REQUEST)
46+
return Response(status=status.HTTP_400_BAD_REQUEST)

0 commit comments

Comments
 (0)