-
Notifications
You must be signed in to change notification settings - Fork 346
fix: propagate #1809 to oauth.Credentials
#1875
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
a283a5b
bec5843
0f52925
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 |
|---|---|---|
|
|
@@ -139,7 +139,7 @@ def __init__( | |
| super(Credentials, self).__init__() | ||
| self.token = token | ||
| self.expiry = expiry | ||
| self._refresh_token = refresh_token | ||
| self._refresh_token_val = refresh_token | ||
| self._id_token = id_token | ||
| self._scopes = scopes | ||
| self._default_scopes = default_scopes | ||
|
|
@@ -178,7 +178,7 @@ def __setstate__(self, d): | |
| all the attributes.""" | ||
| self.token = d.get("token") | ||
| self.expiry = d.get("expiry") | ||
| self._refresh_token = d.get("_refresh_token") | ||
| self._refresh_token_val = d.get("_refresh_token_val") | ||
| self._id_token = d.get("_id_token") | ||
| self._scopes = d.get("_scopes") | ||
| self._default_scopes = d.get("_default_scopes") | ||
|
|
@@ -203,7 +203,7 @@ def __setstate__(self, d): | |
| @property | ||
| def refresh_token(self): | ||
| """Optional[str]: The OAuth 2.0 refresh token.""" | ||
| return self._refresh_token | ||
| return self._refresh_token_val | ||
|
|
||
| @property | ||
| def scopes(self): | ||
|
|
@@ -350,6 +350,9 @@ def with_universe_domain(self, universe_domain): | |
| def _metric_header_for_usage(self): | ||
| return metrics.CRED_TYPE_USER | ||
|
|
||
| def _refresh_token(self, request): | ||
|
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. why not remove this and revert change on. I think using
Author
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.
There is a bigger fix where "private" methods/attributes of source_credentials are not accessed, but that would be a much larger and more complicated change. This PR is only trying to align the interfaces of
Author
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. Apparently not! #1884 |
||
| return self.refresh(request) | ||
|
|
||
| @_helpers.copy_docstring(credentials.Credentials) | ||
| def refresh(self, request): | ||
| if self._universe_domain != credentials.DEFAULT_UNIVERSE_DOMAIN: | ||
|
|
@@ -368,7 +371,7 @@ def refresh(self, request): | |
| # available. This is useful in general when tokens are obtained by calling | ||
| # some external process on demand. It is particularly useful for retrieving | ||
| # downscoped tokens from a token broker. | ||
| if self._refresh_token is None and self.refresh_handler: | ||
| if self._refresh_token_val is None and self.refresh_handler: | ||
| token, expiry = self.refresh_handler(request, scopes=scopes) | ||
| # Validate returned data. | ||
| if not isinstance(token, str): | ||
|
|
@@ -389,7 +392,7 @@ def refresh(self, request): | |
| return | ||
|
|
||
| if ( | ||
| self._refresh_token is None | ||
| self._refresh_token_val is None | ||
| or self._token_uri is None | ||
| or self._client_id is None | ||
| or self._client_secret is None | ||
|
|
@@ -409,7 +412,7 @@ def refresh(self, request): | |
| ) = reauth.refresh_grant( | ||
| request, | ||
| self._token_uri, | ||
| self._refresh_token, | ||
| self._refresh_token_val, | ||
| self._client_id, | ||
| self._client_secret, | ||
| scopes=scopes, | ||
|
|
@@ -419,7 +422,7 @@ def refresh(self, request): | |
|
|
||
| self.token = access_token | ||
| self.expiry = expiry | ||
| self._refresh_token = refresh_token | ||
| self._refresh_token_val = refresh_token | ||
| self._id_token = grant_response.get("id_token") | ||
| self._rapt_token = rapt_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.
I think this and the associated test was missed in #1809