-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: use self-signed JWTs in Spanner MutableCredentials #13381
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,7 +58,9 @@ public MutableCredentials( | |||||||||||||||||
| throw new IllegalArgumentException("Scopes must not be empty"); | ||||||||||||||||||
| } | ||||||||||||||||||
| this.scopes = new java.util.HashSet<>(scopes); | ||||||||||||||||||
| delegate = (ServiceAccountCredentials) credentials.createScoped(this.scopes); | ||||||||||||||||||
| delegate = | ||||||||||||||||||
| ((ServiceAccountCredentials) credentials.createScoped(this.scopes)) | ||||||||||||||||||
| .createWithUseJwtAccessWithScope(true); | ||||||||||||||||||
|
Comment on lines
+61
to
+63
Contributor
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. The cast to
Suggested change
|
||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
|
|
@@ -74,7 +76,9 @@ public MutableCredentials( | |||||||||||||||||
| */ | ||||||||||||||||||
| public void updateCredentials(@Nonnull ServiceAccountCredentials credentials) { | ||||||||||||||||||
| Objects.requireNonNull(credentials, "credentials must not be null"); | ||||||||||||||||||
| delegate = (ServiceAccountCredentials) credentials.createScoped(scopes); | ||||||||||||||||||
| delegate = | ||||||||||||||||||
| ((ServiceAccountCredentials) credentials.createScoped(scopes)) | ||||||||||||||||||
| .createWithUseJwtAccessWithScope(true); | ||||||||||||||||||
|
Comment on lines
+79
to
+81
Contributor
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. The cast to
Suggested change
Contributor
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. The cast is necessary - see other comment
Comment on lines
+79
to
+81
Contributor
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. The cast to
Suggested change
|
||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Override | ||||||||||||||||||
|
|
||||||||||||||||||
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.
The cast to
ServiceAccountCredentialsis redundant becausecredentialsis already of typeServiceAccountCredentials, and itscreateScopedmethod returnsServiceAccountCredentialsvia covariant return type. Removing the redundant cast and extra parentheses improves code readability.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.
The cast is necessary - ServiceAccountCredentials.createScoped returns an instance of GoogleCredentials, not ServiceAccountCredentials