feat(KotlinSDK): Adding IAP support for the Kotlin SDK (#1662)#1672
feat(KotlinSDK): Adding IAP support for the Kotlin SDK (#1662)#1672MitchellGale merged 10 commits intomainfrom
Conversation
This PR adds support for routing API requests through Identity-Aware
Proxy. This is done by putting an OIDC token in the header as
`Proxy-Authorization: Bearer <token>`. The OIDC is generated through
IamCredentialsClient.
To use, users need to provide their `iap_client_id` and
`iap_service_account_email` to the SDK's configuration payload.
```
Map<String, String> lookerConfig = new HashMap<>();
lookerConfig.put("base_url", "<Base_Url>");
lookerConfig.put("kotlin_http_transport", "JAVA_NET");
lookerConfig.put("client_id", "<Client_ID>");
lookerConfig.put("client_secret", "<Client_Secret>");
lookerConfig.put("iap_client_id", "<IAP_Client_ID>");
lookerConfig.put("iap_service_account_email", "<IAP_Service_Account_Email>);
ConfigurationProvider settings = ApiSettings.fromMap(lookerConfig);
Transport transport = new Transport(settings);
AuthSession session = new AuthSession(settings, transport);
LookerSDK sdk = new LookerSDK(session);
```
`iap_client_id` is the OAuth client ID that was set-up when configuring
the the identity-aware proxy.
`iap_service_account_email` is the service account that is authorized to
bypass IAP.
Summary of ChangesHello, 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 Kotlin SDK by introducing support for Google Cloud's Identity-Aware Proxy (IAP). This allows the SDK to securely connect to Looker instances that are protected by IAP, by automatically generating and managing OIDC tokens. The changes involve integrating new Google Cloud libraries, adding new configuration options for IAP credentials, and modifying the authentication and request handling mechanisms to incorporate IAP tokens, thereby broadening the SDK's compatibility with secure deployment patterns. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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
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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for Google IAP (Identity-Aware Proxy) authentication to the Kotlin SDK. This includes adding necessary Google Cloud IAM Credentials dependencies, implementing IAP token generation and caching within AuthSession, and integrating IAP token usage into authentication, login, and logout flows. The Transport layer was updated to allow custom request configuration and to handle potential null HTTP response content more robustly. However, several iapToken properties added to RequestSettings, TransportOptions, TransportSettings, and ApiSettings appear to be redundant as the IAP token is handled directly via request headers and configuration reading, suggesting an opportunity to simplify the data structures.
| var headers: Map<String, String> | ||
| var environmentPrefix: String | ||
| var httpTransport: String | ||
| var iapToken: String? |
There was a problem hiding this comment.
The iapToken property added to the TransportOptions interface seems unused. The AuthSession class reads IAP configuration from apiSettings.readConfig() but does not set this iapToken property on the ConfigurationProvider or TransportOptions instance. This redundancy can lead to confusion.
References
- Avoid introducing unused fields or variables to maintain code clarity and prevent confusion.
|
Hey @drstrangelooker when you get a chance, can you please review this PR? |
|
@MitchellGale can you resolve the issues that Gemini found? |
@drstrangelooker all resolved |
This PR adds support for routing API requests through Identity-Aware
Proxy. This is done by putting an OIDC token in the header as
`Proxy-Authorization: Bearer <token>`. The OIDC is generated through
IamCredentialsClient.
To use, users need to provide their `iap_client_id` and
`iap_service_account_email` to the SDK's configuration payload.
```
Map<String, String> lookerConfig = new HashMap<>();
lookerConfig.put("base_url", "<Base_Url>");
lookerConfig.put("kotlin_http_transport", "JAVA_NET");
lookerConfig.put("client_id", "<Client_ID>");
lookerConfig.put("client_secret", "<Client_Secret>");
lookerConfig.put("iap_client_id", "<IAP_Client_ID>");
lookerConfig.put("iap_service_account_email", "<IAP_Service_Account_Email>);
ConfigurationProvider settings = ApiSettings.fromMap(lookerConfig);
Transport transport = new Transport(settings);
AuthSession session = new AuthSession(settings, transport);
LookerSDK sdk = new LookerSDK(session);
```
`iap_client_id` is the OAuth client ID that was set-up when configuring
the the identity-aware proxy.
`iap_service_account_email` is the service account that is authorized to
bypass IAP.
Release-As: 26.6.2
🤖 I have created a release *beep* *boop* --- <details><summary>sdk-codegen-all: 26.6.2</summary> ## [26.6.2](sdk-codegen-all-v26.6.1...sdk-codegen-all-v26.6.2) (2026-03-27) ### Features * **KotlinSDK:** Adding IAP support for the Kotlin SDK ([#1662](#1662)) ([#1672](#1672)) ([80b34e1](80b34e1)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This PR adds support for routing API requests through Identity-Aware Proxy. This is done by putting an OIDC token in the header as
Proxy-Authorization: Bearer <token>. The OIDC is generated through IamCredentialsClient.To use, users need to provide their
iap_client_idandiap_service_account_emailto the SDK's configuration payload.iap_client_idis the OAuth client ID that was set-up when configuring the the identity-aware proxy.iap_service_account_emailis the service account that is authorized to bypass IAP.