Skip to content

Commit

Permalink
fix: Fix IDTokenCredentials update bug (#1072)
Browse files Browse the repository at this point in the history
* fix: IDTokenCredentials Constructor bug

Co-authored-by: clundin25 <108372512+clundin25@users.noreply.github.com>
  • Loading branch information
mbmccoy and clundin25 authored Aug 4, 2022
1 parent 1ad970f commit b62c25c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion google/auth/impersonated_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def __init__(

def from_credentials(self, target_credentials, target_audience=None):
return self.__class__(
target_credentials=self._target_credentials,
target_credentials=target_credentials,
target_audience=target_audience,
include_email=self._include_email,
quota_project_id=self._quota_project_id,
Expand Down
Binary file modified system_tests/secrets.tar.enc
Binary file not shown.
5 changes: 4 additions & 1 deletion tests/test_impersonated_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,17 @@ def test_id_token_from_credential(
assert credentials.valid
assert not credentials.expired

new_credentials = self.make_credentials(lifetime=None)

id_creds = impersonated_credentials.IDTokenCredentials(
credentials, target_audience=target_audience, include_email=True
)
id_creds = id_creds.from_credentials(target_credentials=credentials)
id_creds = id_creds.from_credentials(target_credentials=new_credentials)
id_creds.refresh(request)

assert id_creds.token == ID_TOKEN_DATA
assert id_creds._include_email is True
assert id_creds._target_credentials is new_credentials

def test_id_token_with_target_audience(
self, mock_donor_credentials, mock_authorizedsession_idtoken
Expand Down

0 comments on commit b62c25c

Please # to comment.