Skip to content
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

Merged
merged 13 commits into from
Aug 1, 2017

Conversation

poxip
Copy link

@poxip poxip commented Jul 23, 2017

Also disallow passing permanent_token header in views other than the Device's token refresh view (APDS-63)

… than device refresh

This requires APDS-62 to be finished
@poxip poxip changed the title APDS-63 - [BE] disallow passing permanent_token header i APDS-63 - [BE] disallow passing permanent_token header Jul 23, 2017
@poxip poxip changed the base branch from feature/APDS-64-logout to feature/APDS-62-api-to-refresh-token July 24, 2017 11:01
@poxip poxip changed the base branch from feature/APDS-62-api-to-refresh-token to feature/APDS-64-logout July 24, 2017 11:12
@poxip poxip changed the title APDS-63 - [BE] disallow passing permanent_token header APDS-63, APDS-62 - [BE] add API to refresh token using permanent_token Jul 24, 2017
@poxip poxip requested review from jacoor and pkrzyzaniak July 24, 2017 11:13
@poxip poxip changed the base branch from feature/APDS-64-logout to feature/APDS-64-add-logout July 24, 2017 11:30
payload = jwt_payload_handler(device.user)
return {
'token': jwt_encode_handler(payload),
'permanent_token': permanent_token,
Copy link

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?

@@ -124,7 +154,7 @@ def get(self, request):
return Response({}, status=status.HTTP_200_OK)
Copy link

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.

@@ -124,7 +154,7 @@ def get(self, request):
return Response({}, status=status.HTTP_200_OK)
Copy link

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.

payload = jwt_payload_handler(device.user, device=device)
return {
'token': jwt_encode_handler(payload),
'user': device.user
Copy link

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?

Copy link

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?

Copy link
Author

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.

Copy link

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.

@jacoor jacoor requested a review from remik July 28, 2017 11:33
@poxip poxip merged commit 8368874 into feature/APDS-64-add-logout Aug 1, 2017
poxip added a commit that referenced this pull request Aug 1, 2017
* 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
poxip added a commit that referenced this pull request Aug 1, 2017
* 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
poxip added a commit that referenced this pull request Aug 1, 2017
* 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
@poxip poxip deleted the feature/APDS-63 branch August 1, 2017 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants