feat: use self-signed JWTs in Spanner MutableCredentials#13381
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates MutableCredentials to use JWT access with scope by calling .createWithUseJwtAccessWithScope(true) on the scoped credentials, and updates the corresponding unit tests to mock this behavior. The review feedback points out redundant casts to ServiceAccountCredentials in both the constructor and the updateCredentials method, suggesting their removal to improve code readability.
| delegate = | ||
| ((ServiceAccountCredentials) credentials.createScoped(this.scopes)) | ||
| .createWithUseJwtAccessWithScope(true); |
There was a problem hiding this comment.
The cast to ServiceAccountCredentials is redundant because credentials is already of type ServiceAccountCredentials, and its createScoped method returns ServiceAccountCredentials via covariant return type. Removing the redundant cast and extra parentheses improves code readability.
| delegate = | |
| ((ServiceAccountCredentials) credentials.createScoped(this.scopes)) | |
| .createWithUseJwtAccessWithScope(true); | |
| delegate = credentials.createScoped(this.scopes).createWithUseJwtAccessWithScope(true); |
| delegate = | ||
| ((ServiceAccountCredentials) credentials.createScoped(scopes)) | ||
| .createWithUseJwtAccessWithScope(true); |
There was a problem hiding this comment.
The cast to ServiceAccountCredentials is redundant here as well because credentials is of type ServiceAccountCredentials. Removing the redundant cast and extra parentheses simplifies the code.
| delegate = | |
| ((ServiceAccountCredentials) credentials.createScoped(scopes)) | |
| .createWithUseJwtAccessWithScope(true); | |
| delegate = credentials.createScoped(scopes).createWithUseJwtAccessWithScope(true); |
WIP