Parse JWT exp claim from token to set expires_at_millis_#10
Parse JWT exp claim from token to set expires_at_millis_#10
Conversation
- Implement Base64UrlDecode in TransformUtil. - Update AuthProperties::FromProperties to parse the JWT exp claim from the token and set expires_at_millis_. - Add expires_at_millis() getter to AuthProperties. - Add unit tests for Base64UrlDecode and JWT expiration parsing. Co-authored-by: wgtmac <4684607+wgtmac@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Implement robust Base64UrlDecode in TransformUtil using unsigned integers to avoid undefined behavior. - Update AuthProperties::FromProperties to parse the JWT exp claim from the token and set expires_at_millis_. - Add expires_at_millis() getter to AuthProperties. - Add unit tests for Base64UrlDecode and JWT expiration parsing, using standard matchers and explicit type casting for Windows/MSVC compatibility. Co-authored-by: wgtmac <4684607+wgtmac@users.noreply.github.com>
|
@jules fix all ci failures |
- Implement robust Base64UrlDecode in TransformUtil using unsigned integers to avoid undefined behavior. - Update AuthProperties::FromProperties to parse the JWT exp claim from the token and set expires_at_millis_. - Add expires_at_millis() getter to AuthProperties. - Add unit tests for Base64UrlDecode and JWT expiration parsing. - Improve HasValue matcher to support non-matcher arguments and fix MSVC template issues by using SafeMatcherCast and DescribeMatcher. Co-authored-by: wgtmac <4684607+wgtmac@users.noreply.github.com>
This change implements parsing of the JWT
exp(expiration) claim from the OAuth2 token inAuthProperties.Key changes:
Base64UrlDecodeto handle RFC 4648 Base64Url encoding, which is used in JWT payloads. The implementation is robust against integer overflow and handles both standard and URL-safe Base64 characters.FromPropertiesto detect if a token is present.expclaim.expires_at_millis_.expires_at_millis().Base64UrlDecodewith various test vectors, including edge cases and invalid characters.AuthManagerTestto verify thatAuthPropertiescorrectly parses the expiration time from a mock JWT token and handles invalid tokens gracefully.PR created automatically by Jules for task 409089801954026600 started by @wgtmac