Commit 29c061e
authored
fix: S2A gRPC flow creates ComputeEngineCredentials via newBuilder. (#3651)
@rockspore pointed out that the credential should be created from
scratch because when using
[toBuilder](https://github.com/googleapis/google-auth-library-java/blob/main/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java#L648)
the underlying [access token is
copied](https://github.com/googleapis/google-auth-library-java/blob/37d228410e99799e4a7be8650fe472ea712c9b4d/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java#L657).
This was confirmed to be a bug with local testing which:
- deployed a GAE app, the app performs the below two actions
sequentially
- create Google API client ( `allowedHardBoundAccessTokens` empty in
GrpcProvider) and then ping the API, logs show the bearer token is used,
obtained from making call to MDS
- create a Google API client ( `allowedHardBoundAccessTokens` contains
`MTLS_S2A` in GrpcProvider) and then ping the API, logs show the bearer
token is used. A call to MDS is **not** made.
This is likely because the credential and channel have different
lifetimes.1 parent fe002fa commit 29c061e
File tree
1 file changed
+12
-3
lines changed- gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc
1 file changed
+12
-3
lines changedLines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1200 | 1200 | | |
1201 | 1201 | | |
1202 | 1202 | | |
| 1203 | + | |
| 1204 | + | |
1203 | 1205 | | |
1204 | | - | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
1205 | 1213 | | |
1206 | | - | |
1207 | | - | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
1208 | 1217 | | |
1209 | 1218 | | |
1210 | 1219 | | |
| |||
0 commit comments