-
Notifications
You must be signed in to change notification settings - Fork 456
Support for generating refresh tokens #152
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,11 +131,18 @@ def validate_client_id(self, client_id): | |
if token_generator and not callable(token_generator): | ||
token_generator = import_string(token_generator) | ||
|
||
refresh_token_generator = self.app.config.get( | ||
'OAUTH2_PROVIDER_REFRESH_TOKEN_GENERATOR', None | ||
) | ||
if refresh_token_generator and not callable(refresh_token_generator): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. callable? I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, callable is "undeprecated" as of http://bugs.python.org/issue10518 so I guess callable() would be the way to do it? |
||
refresh_token_generator = import_string(refresh_token_generator) | ||
|
||
if hasattr(self, '_validator'): | ||
return Server( | ||
self._validator, | ||
token_expires_in=expires_in, | ||
token_generator=token_generator, | ||
refresh_token_generator=refresh_token_generator, | ||
) | ||
|
||
if hasattr(self, '_clientgetter') and \ | ||
|
@@ -161,6 +168,7 @@ def validate_client_id(self, client_id): | |
validator, | ||
token_expires_in=expires_in, | ||
token_generator=token_generator, | ||
refresh_token_generator=refresh_token_generator, | ||
) | ||
raise RuntimeError('application not bound to required getters') | ||
|
||
|
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 just copied the block that handled "the other generator". I agree with "isinstance", but let's do that in a separate commit - and then fix both cases of course. I'll upload that soon.
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.
(as I wrote above - callable() is "okey" again, so I'll don't upload any new commits to fix that, unless you insist)