-
Notifications
You must be signed in to change notification settings - Fork 432
Fixing incremental auth in flask_util. #322
Conversation
Sigh, python 2.6, you are a thorn in my side. |
LGTM. Tested it on my sample cases and it worked fine. |
@@ -331,6 +333,20 @@ def _make_flow(self, return_url=None, **kwargs): | |||
redirect_uri=url_for('oauth2.callback', _external=True), | |||
**kw) | |||
|
|||
flow_key = 'google_oauth2_flow_{0}'.format(csrf_token) | |||
session[flow_key] = pickle.dumps(flow) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@dhermes anything holding this back from being merged? |
I didn't really review this and don't have throughput to do it. I'll leave it to @nathanielmanistaatgoogle |
I'll try to get to this sometime this week. Does it have time-sensitivity to it? |
I don't think it's especially urgent (though not sure what Jon thinks), but it does fix some critical bugs with the extension and it's a somewhat small patch. |
Not overly urgent as I doubt many people are using incremental auth at this point. I would like to have this, #326, #325, #323, and All-in-all, lots of new features specific to the usage of web applications. Once we have those in and battle tested a little, we can start promoting them. |
|
||
return flow | ||
|
||
def _get_flow_for_token(self, csrf_token): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Thank you for that thorough review @nathanielmanistaatgoogle. I think I got everything. |
flow_pickle = session.get( | ||
self._flow_key.format(csrf_token), None) | ||
|
||
if not flow_pickle: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Okay, moved |
@@ -191,6 +192,21 @@ def requires_calendar(): | |||
__author__ = '[email protected] (Jon Wayne Parrott)' | |||
|
|||
DEFAULT_SCOPES = ('email',) | |||
CREDENTIALS_KEY = 'google_oauth2_credentials' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
session['google_oauth2_csrf_token'] = 'tokenz' | ||
|
||
state = '[{' | ||
rv = c.get('/oauth2callback?state=%s&code=codez' % state) | ||
self.assertEqual(rv.status_code, httplib.BAD_REQUEST) | ||
response = client.get('/oauth2callback?state=%s&code=codez' % state) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I think I'm done with comments now. Fingers crossed. |
Fingers crossed here too, thanks for the review. :) |
* Flow is now stored in the session, ensuring that the scopes survive the round trip to the auth server. * The base credentials are now checked in `required`, solving an issue where it's possible to pass the check with the incremental scopes but without the base scopes. Fixes googleapis#320
Fixed incremental auth in flask_util.
Thanks! On Wed, Oct 21, 2015, 5:04 PM Nathaniel Manista [email protected]
|
required
, solving an issue where it's possible to pass the check with the incremental scopes but without the base scopes.Fixes #320