impl(auth): Integrate service account with token cache#1628
Merged
sai-sunder-s merged 1 commit intogoogleapis:mainfrom Mar 27, 2025
Merged
impl(auth): Integrate service account with token cache#1628sai-sunder-s merged 1 commit intogoogleapis:mainfrom
sai-sunder-s merged 1 commit intogoogleapis:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1628 +/- ##
=======================================
Coverage 95.71% 95.71%
=======================================
Files 43 43
Lines 1821 1822 +1
=======================================
+ Hits 1743 1744 +1
Misses 78 78 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dbolduc
approved these changes
Mar 27, 2025
| let captures = re.captures(&token.token).unwrap(); | ||
|
|
||
| let claims = b64_decode_to_json(captures["claims"].to_string()); | ||
| let first_iat = claims["iat"].as_f64().unwrap(); |
Member
There was a problem hiding this comment.
nit: here and below, as_i64() seems more appropriate, even though all json numbers are floats
https://docs.rs/time/latest/src/time/serde/timestamp/mod.rs.html#24
https://docs.rs/time/latest/src/time/offset_date_time.rs.html#452
Comment on lines
+406
to
+407
| // Need real sleep because iat is not built using tokio::time::Instant. | ||
| // Need 1 second sleep because OffsetDateTime's granularity is seconds. |
Member
There was a problem hiding this comment.
maybe:
// The `iat` claim encodes the unix timestamp, in seconds. Sleeping for
// one second ensures that a subsequent claim has a different `iat`. We
// need a real sleep, because we cannot fake the current unix timestamp.
| let claims = b64_decode_to_json(captures["claims"].to_string()); | ||
| let second_iat = claims["iat"].as_f64().unwrap(); | ||
|
|
||
| // Validate that the issued at claim is exactly same for the 2 tokens. |
Member
|
oops, I did not notice the automerge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.