-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APDS-63, APDS-62 - [BE] add API to refresh token using permanent_token #4
Conversation
… than device refresh This requires APDS-62 to be finished
rest_framework_jwt/serializers.py
Outdated
payload = jwt_payload_handler(device.user) | ||
return { | ||
'token': jwt_encode_handler(payload), | ||
'permanent_token': permanent_token, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And why do you return permanent token here?
rest_framework_jwt/views.py
Outdated
@@ -124,7 +154,7 @@ def get(self, request): | |||
return Response({}, status=status.HTTP_200_OK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can send device id in response to login for them to store which should be send everytime in headers.
Or they can send you permanent token in delete call.
rest_framework_jwt/views.py
Outdated
@@ -124,7 +154,7 @@ def get(self, request): | |||
return Response({}, status=status.HTTP_200_OK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PLeasae also do not leave it as "200 OK" - just raise exception always until it is implemented.
…django-rest-framework-jwt into feature/APDS-63
payload = jwt_payload_handler(device.user, device=device) | ||
return { | ||
'token': jwt_encode_handler(payload), | ||
'user': device.user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you return user?
User is already(should be) encoded in JWT token, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if not, it should not return user, only token. And, btw, why you return manually data instead of using serializers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based this on the JSONWebTokenSerializer above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. Our implementation encodes user in JWT token, as you remember. Keep as is for now please. We will update later
@remik FYI.
* APDS-64 - [BE] remove Device on logout * Corrects * Replace doublequotes with singlequotes * Remove duplicated lines * Remove python setting from Travis config * Use user agent in logout view * Fix tests * Remove Python 3.3 from travis * CR * CR * APDS-63, APDS-62 - [BE] add API to refresh token using permanent_token (#4) * APDS-63 - [BE] disallow passing permanent_token header in views other than device refresh This requires APDS-62 to be finished * APDS-62 - [BE] add API to refresh token using permanent_token * Replace doublequotes with singlequotes * Update with changes from APDS-62 * Remove python setting from .travis.yml * Correct tests * Auto logout when permanent token has expired * Remove Python 3.3 from travis * CR * Remove addons from .travis.yml
* APDS-65 - [BE] modify login API to generate permanent token * Remove TODO * Remove python select from travis config * Use user agent * Remove Python 3.3 from travis * CR * Correct * APDS-64 - [BE] add API to logout device (#6) * APDS-64 - [BE] remove Device on logout * Corrects * Replace doublequotes with singlequotes * Remove duplicated lines * Remove python setting from Travis config * Use user agent in logout view * Fix tests * Remove Python 3.3 from travis * CR * CR * APDS-63, APDS-62 - [BE] add API to refresh token using permanent_token (#4) * APDS-63 - [BE] disallow passing permanent_token header in views other than device refresh This requires APDS-62 to be finished * APDS-62 - [BE] add API to refresh token using permanent_token * Replace doublequotes with singlequotes * Update with changes from APDS-62 * Remove python setting from .travis.yml * Correct tests * Auto logout when permanent token has expired * Remove Python 3.3 from travis * CR * Remove addons from .travis.yml
* APDS-61 - add API to list and delete permanent tokens * CR * Use router * Revert tox.ini * Revert Readme * Use format='json' in requests * Modify client.login() call * Add auto_now to Device.last_request_datetime * Revert .travis.yml * Tox: remove py33 and add py36 * tox: revert and add Python 3.3 * Do not test under Python 3.3 * CR Change jwt_secret to UUUIDField with auto value, add Device.id and remove vulnerable data from Device serializer * APDS-65 - [BE] modify login API to generate permanent token (#2) * APDS-65 - [BE] modify login API to generate permanent token * Remove TODO * Remove python select from travis config * Use user agent * Remove Python 3.3 from travis * CR * Correct * APDS-64 - [BE] add API to logout device (#6) * APDS-64 - [BE] remove Device on logout * Corrects * Replace doublequotes with singlequotes * Remove duplicated lines * Remove python setting from Travis config * Use user agent in logout view * Fix tests * Remove Python 3.3 from travis * CR * CR * APDS-63, APDS-62 - [BE] add API to refresh token using permanent_token (#4) * APDS-63 - [BE] disallow passing permanent_token header in views other than device refresh This requires APDS-62 to be finished * APDS-62 - [BE] add API to refresh token using permanent_token * Replace doublequotes with singlequotes * Update with changes from APDS-62 * Remove python setting from .travis.yml * Correct tests * Auto logout when permanent token has expired * Remove Python 3.3 from travis * CR * Remove addons from .travis.yml
Also disallow passing permanent_token header in views other than the Device's token refresh view (APDS-63)