oauth2/google/externalaccount
Jin Qin 3c9c1f6d00 oauth2/google: fix the logic of sts 0 value of expires_in
The sts response contains an optional field of `expires_in` and the value can be any integer.

https://github.com/golang/oauth2/blob/master/google/internal/externalaccount/basecredentials.go#L246-L248

In the case of less than `0`, we are going to throw an error. But in the case of equals to `0` practically it means "never expire" instead of "instantly expire" which doesn't make sense.

So we need to not set the expiration value for Token object. The current else if greater or equal is wrong.

It's never triggered only because we are sending positive `3600` in sts response.

Change-Id: Id227ca71130855235572b65ab178681e80d0da3a
GitHub-Last-Rev: a95c923d6a
GitHub-Pull-Request: golang/oauth2#687
Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/545895
Reviewed-by: Shin Fan <shinfan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cody Oss <codyoss@google.com>
Reviewed-by: Cody Oss <codyoss@google.com>
2024-03-12 20:05:50 +00:00
..
testdata google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
aws.go oauth2/google: fix remove content-type header from idms get requests 2024-03-12 14:54:40 +00:00
aws_test.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
basecredentials.go oauth2/google: fix the logic of sts 0 value of expires_in 2024-03-12 20:05:50 +00:00
basecredentials_test.go oauth2/google: fix the logic of sts 0 value of expires_in 2024-03-12 20:05:50 +00:00
executablecredsource.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
executablecredsource_test.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
filecredsource.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
filecredsource_test.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
header.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
header_test.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
programmaticrefreshcredsource.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
programmaticrefreshcredsource_test.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
urlcredsource.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00
urlcredsource_test.go google/externalaccount: moves externalaccount package out of internal and exports it 2024-02-27 21:55:11 +00:00