Skip to content

Conversation

@havetisyan
Copy link
Collaborator

@havetisyan havetisyan commented Nov 7, 2025

Description

part of #3100 support. expose the jag token support in java client

Contribution Checklist:

  • The pull request does not introduce any breaking changes
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Attach Screenshots (Optional)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @havetisyan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the ZTS Java client by introducing robust support for JWT Authorization Grant (JAG) API functions. It refactors the token request building process into a dedicated OAuthTokenRequestBuilder and updates the ZTSClient to provide new methods for obtaining and exchanging JAG tokens. Additionally, it includes critical null checks in RDL-generated client code for improved stability and expands the test suite to cover the new and modified functionalities.

Highlights

  • New OAuth Token Request Builder: Introduced a new OAuthTokenRequestBuilder class in the ZTS Java client to provide a flexible and comprehensive way to construct OAuth token requests, supporting various grant types and parameters.
  • JAG API Exposure: The ZTSClient now exposes new public methods, getJAGToken and getJAGExchangeToken, allowing clients to request and exchange JWT Authorization Grant (JAG) tokens.
  • Refactored Token Retrieval Logic: The internal token retrieval logic in ZTSClient has been refactored into a new getToken method, which centralizes caching, prefetching, and error handling for all token types, and the old AccessTokenRequestBuilder has been removed.
  • Robust Header Handling in RDL Clients: Added null checks for ETag and Location headers in several RDL-generated client files (MSDRDLGeneratedClient.java, ZMSRDLGeneratedClient.java, ZTSRDLGeneratedClient.java) to prevent potential NullPointerExceptions.
  • Enhanced Test Coverage: New test files have been added for ClientResourceException, IdTokenCacheEntry, OAuthTokenRequestBuilder, ZTSClientCache, and ZTSClientNotification, significantly improving the test coverage for the ZTS Java client.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for JWT Authorization Grant (JAG) tokens by adding a new OAuthTokenRequestBuilder and refactoring the ZTSClient to use it. This is a significant and well-structured change that improves the client's capabilities. Additionally, it includes important bug fixes to prevent potential NullPointerExceptions in generated client code when handling HTTP headers. My review focuses on a likely copy-paste error in the new token methods, a potential issue with cache key generation, and a point of clarification in the prefetch logic. The inclusion of comprehensive new tests is a great addition.

@abvaidya abvaidya merged commit aecdfac into master Nov 9, 2025
8 checks passed
@abvaidya abvaidya deleted the jag-zts branch November 9, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants