-
Notifications
You must be signed in to change notification settings - Fork 92
feat(auth): verify id token #3516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(auth): verify id token #3516
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3516 +/- ##
==========================================
- Coverage 95.78% 95.67% -0.11%
==========================================
Files 120 125 +5
Lines 4820 4999 +179
==========================================
+ Hits 4617 4783 +166
- Misses 203 216 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/auth/src/credentials/idtoken.rs
Outdated
|
||
impl Verifier { | ||
/// Sets the audience for the token verification. | ||
pub fn with_audience<S: Into<String>>(mut self, audience: S) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a bit odd that I can set the audience, but not clear the audience.
Should we separate this to a builder and once built we disable all functions to change the audience, email or clock skew?
let response = client | ||
.get(jwks_url) | ||
.send() | ||
.await | ||
.map_err(|e| crate::errors::from_http_error(e, "failed to fetch JWK set"))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a retry loop? Do we need to cache the reqwest client (not if these calls are rare)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, adding retries is a good call, but I was planning to add retries to all id token related features later, to reduce the amount of things to be reviewed first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then file a bug (maybe a sub-issue) and add a comment like // TODO(#...) - add a retry loop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed some of the review comments.
let response = client | ||
.get(jwks_url) | ||
.send() | ||
.await | ||
.map_err(|e| crate::errors::from_http_error(e, "failed to fetch JWK set"))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, adding retries is a good call, but I was planning to add retries to all id token related features later, to reduce the amount of things to be reviewed first.
Implement verify id token function, per https://google.aip.dev/auth/4116#expected-behavior-for-verifying-id-tokens
Towards #3449