Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add service_account.Credentials.with_claims #140

Merged
merged 2 commits into from
Mar 23, 2017
Merged

Conversation

theacodes
Copy link
Contributor

@theacodes theacodes commented Mar 22, 2017

Resolves #129.

@@ -426,13 +426,15 @@ def with_claims(self, issuer=None, subject=None, audience=None,
Returns:
google.auth.jwt.Credentials: A new credentials instance.
"""
new_additional_claims = self._additional_claims.copy()

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -426,13 +426,15 @@ def with_claims(self, issuer=None, subject=None, audience=None,
Returns:
google.auth.jwt.Credentials: A new credentials instance.
"""
new_additional_claims = self._additional_claims.copy()
new_additional_claims.update(additional_claims or {})

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -246,6 +246,29 @@ def with_subject(self, subject):
subject=subject,
additional_claims=self._additional_claims.copy())

def with_claims(self, additional_claims):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Mar 23, 2017

LGTM I suppose. It seems you want to eat the teeny cost of or {} every time, so it's all good?

@theacodes
Copy link
Contributor Author

It seems you want to eat the teeny cost of or {} every time, so it's all good?

The cost of that vs. the cost of copy/deepcopy is insignificant.

I'm going to update this to use deepcopy, but I'm finishing something else up first. Thanks for the review!

@theacodes theacodes merged commit 75c78b2 into master Mar 23, 2017
@theacodes theacodes deleted the service-account-claims branch March 23, 2017 20:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants