Repository navigation
docs(auth): document certificate-bound tokens for agent identities - #14557
macastelaz wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for certificate-bound access and ID tokens for agent identities within ComputeEngineCredentials. It adds a new AgentIdentityUtils utility class to manage certificate discovery, SPIFFE trust domain validation, cryptographic key-pair verification, and credential caching. ComputeEngineCredentials is updated to request bound tokens via POST requests to the metadata server when a workload certificate is available. Feedback on the changes suggests improving code readability in the test suite by avoiding fully qualified class names when the class is already imported.
| Files.write(keyPath, mismatchedKeyPem.getBytes(StandardCharsets.UTF_8)); | ||
| Files.setLastModifiedTime( |
There was a problem hiding this comment.
Avoid using fully qualified class names (such as java.nio.file.attribute.FileTime) if there is no class name conflict in the file and the class is already imported, as it unnecessarily reduces code readability.
Files.setLastModifiedTime(
keyPath, FileTime.fromMillis(System.currentTimeMillis() + 10000));References
- Do not use fully qualified class names if there is no class name conflict in the file and the class is already imported, as it unnecessarily reduces code readability.
145cc34 to
70f3109
Compare
…igquery pom (#14587) ## Why Every PR into `agentic-identities-bound-token` is currently failing CI (for example #14559 and #14557, about 35 jobs each) with: ``` [ERROR] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.google.cloud:google-cloud-storage:jar -> duplicate declaration of version (?) [ERROR] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.google.cloud:google-cloud-datacatalog:jar -> duplicate declaration of version 1.102.0-SNAPSHOT [ERROR] The build could not read 1 project ``` `java-bigquery/google-cloud-bigquery/pom.xml` declares `google-cloud-storage` and `google-cloud-datacatalog` twice in `<dependencies>`. This has been the case for a while, but Maven 3.9 only logged a `[WARNING]`. The GitHub `ubuntu-24.04` runner image `20261004` upgraded Maven from 3.9.16 to 3.10.0, which treats it as an error, so any job that loads the reactor now fails immediately. ## Change Remove the second declaration of each dependency (11 lines, one file): - `google-cloud-storage`: drops the later test-scoped entry. This is the same change as #14586 on `main`. - `google-cloud-datacatalog`: drops the second, identical test-scoped entry. `main` no longer has this dependency in this pom, so #14586 doesn't need it. ## Verification - `mvn help:effective-pom` on the module before and after: the effective `<dependencies>` section is identical. `google-cloud-storage` stays test-scoped because the parent's `dependencyManagement` sets `<scope>test</scope>`, and the two datacatalog entries were identical. - Each artifact now appears once in `<dependencies>`; the pom parses as valid XML.
Adds a README section and ComputeEngineCredentials class Javadoc covering: - bound tokens are the default when an agent identity workload certificate is present, and require mTLS with the same certificate - when a bound token is requested (cert discovery, agent SPIFFE trust domain) - opt-out env vars and precedence: GOOGLE_API_ENABLE_RUNTIME_BOUND_TOKEN over the legacy GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES, and GOOGLE_API_USE_CLIENT_CERTIFICATE=false also disabling binding - the process-wide scope of the opt-out - requesting unbound ID tokens for specific targets with IdTokenProvider.Option.BIND_ID_TOKEN_FALSE - the ADK for Java known limitation and its workaround
70f3109 to
d02e19a
Compare
Important
Merge after #14559, which adds
IdTokenProvider.Option.BIND_ID_TOKEN_FALSEdocumented here. Both must merge before theagentic-identities-bound-tokenfeature branch is merged tomain.What this adds
Docs only; no code changes.
google-auth-library-java/README.md: new section "Certificate-bound tokens for agent identities":GOOGLE_API_CERTIFICATE_CONFIGor the default directory, and an agent identity SPIFFE trust domain.GOOGLE_API_ENABLE_RUNTIME_BOUND_TOKEN=false, which takes precedence over the legacyGOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES.GOOGLE_API_USE_CLIENT_CERTIFICATE=falsealso turns binding off. Values are case-insensitive, the opt-out applies to the whole process, and it's strongly discouraged.*.run.appURL or a custom domain) reject bound ID tokens, so callers passIdTokenProvider.Option.BIND_ID_TOKEN_FALSEfor those targets, with a code example. Access tokens and other targets stay bound.401; the workaround is the opt-out.ComputeEngineCredentialsclass Javadoc: the same behavior in brief, including the per-target ID-token option and the fail-fast cases. If the certificate config points to missing files, or the metadata server doesn't support bound tokens, requests throwIOExceptioninstead of silently falling back to unbound tokens.All statements were checked against
AgentIdentityUtilsandComputeEngineCredentialsonagentic-identities-bound-token, and against #14559 for the new option.The Cloud Run public docs are being updated separately (internal CL), and the README links to https://cloud.google.com/run/docs/ai/authenticate-agents.
Release notes
google-auth-library-java/CHANGELOG.mdis generated, so release notes come from commit messages. Suggested text for theBEGIN_COMMIT_OVERRIDEblock of the feature-branch →mainmerge PR:Testing
fmt-maven-plugin:checkpasses.