googleapis / google-auth-library-java

Open source Auth client library for Java
https://developers.google.com/identity
BSD 3-Clause "New" or "Revised" License
405 stars 218 forks source link

fix: ComputeEngineCredentials.createScoped should invalidate existing AccessToken #1428

Open zhumin8 opened 2 days ago

zhumin8 commented 2 days ago

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

Fixes #1387 ☕️

If you write sample code, please follow the samples format.


As described in the original issue, this looks like a regression introduced in https://github.com/googleapis/google-auth-library-java/commit/7e268611d2c2152e84702b1c67ca846902bbe2d5 when migrating from deprecated constructor to use builder. Access token is scoped and should be invalidated when scope changes.

This is a draft for discussion, changes included:

TODOs:

sonarcloud[bot] commented 2 days ago

Quality Gate Passed Quality Gate passed

Issues
6 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud