Skip to content

Commit

Permalink
fix(google): get email from the key, db entry is not always returned …
Browse files Browse the repository at this point in the history
…by underlying function
  • Loading branch information
Avantol13-machine-user committed May 25, 2021
1 parent 7bf7028 commit 3112c2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fence/blueprints/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,10 @@ def post(self):

# do the same thing signed URL creation is doing, but don't use the resulting
# key, just extract the service account email
_, key_db_entry = get_or_create_primary_service_account_key(
sa_private_key, _ = get_or_create_primary_service_account_key(
user_id=user_id, username=username, proxy_group_id=proxy_group_id
)
service_account_email = key_db_entry.google_service_account.email
service_account_email = sa_private_key.get("client_email")

# NOTE: service_account_from_db.email is what gets populated in the UserInfo endpoint's
# "primary_google_service_account" as well, so this remains consistent
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ def primary_google_service_account_google(
"type": "service_account",
"project_id": "project-id",
"private_key_id": "some_number",
"client_email": "<api-name>api@project-id.iam.gserviceaccount.com",
"client_email": email,
"client_id": "...",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
Expand Down

0 comments on commit 3112c2d

Please sign in to comment.