Skip to content

Commit e436562

Browse files
committed
Payload generator should accept input from the request serializer
1 parent e86f6bd commit e436562

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

rest_framework_sso/views.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ class ObtainAuthorizationTokenView(BaseAPIView):
8585
serializer_class = AuthorizationTokenSerializer
8686

8787
def post(self, request, *args, **kwargs):
88+
serializer = self.get_serializer(data=request.data)
89+
serializer.is_valid(raise_exception=True)
90+
8891
if hasattr(request.auth, 'get') and request.auth.get('sid'):
8992
try:
9093
session_token = SessionToken.objects.active().\
@@ -97,7 +100,11 @@ def post(self, request, *args, **kwargs):
97100

98101
session_token.update_attributes(request=request)
99102
session_token.save()
100-
payload = create_authorization_payload(session_token=session_token, user=request.user)
103+
payload = create_authorization_payload(
104+
session_token=session_token,
105+
user=request.user,
106+
**serializer.validated_data
107+
)
101108
jwt_token = encode_jwt_token(payload=payload)
102109
return Response({'token': jwt_token})
103110

0 commit comments

Comments
 (0)