-
Notifications
You must be signed in to change notification settings - Fork 311
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
Add service_account.Credentials.with_claims #140
Conversation
google/auth/jwt.py
Outdated
@@ -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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
google/auth/jwt.py
Outdated
@@ -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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
LGTM I suppose. It seems you want to eat the teeny cost of |
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! |
Resolves #129.