Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

lqiu96
Copy link
Member

@lqiu96 lqiu96 commented Jan 2, 2024

Universe Domain validation ensures that the user configured value matches the one set in the Credentials. If validation does not succeed, the call should not proceed. Validating the unvierse domain should occur prior to each RPC invocation.

Behavior shared between transports:

  • Try to validate the credentials. If universe domain matches, proceed with the call. Otherwise, return an Unauthorized exception back to the user.

Transport Specific Behavior:

  • gRPC: If the Credentials is unable to get the universe domain due to an Auth Exception, mark the exception as Unavailable and retry the call following the retry bounds defined by the RPC. Otherwise, return the exception back to the user.
  • HttpJson: If the Credentials is unable to get the universe domain due to an Auth Exception, return the exception back to the user.

CallContext's merge()

Callables are created with the TransportCallableFactory using the defaultCallContext. The defaultCallContext is merged with the call's callcontext in a default invocation:

return UnaryCallable.this.futureCall(request, defaultCallContext.merge(thisCallContext));

GAPIC clients expose callables which invoke the call() with a null callcontext: https://github.com/googleapis/google-cloud-java/blob/c12ae4aacc597161211d53f15c60d6ab904d19d2/java-accessapproval/google-cloud-accessapproval/src/main/java/com/google/cloud/accessapproval/v1/AccessApprovalAdminClient.java#L701-L703.
Merge is not invoked and does not result in creating the EndpointContext over and over again.

@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Jan 2, 2024
@lqiu96 lqiu96 force-pushed the validate-universe-domain branch from 558e3fb to 34e109c Compare January 8, 2024 20:33
@lqiu96 lqiu96 marked this pull request as ready for review January 9, 2024 19:41
@lqiu96 lqiu96 requested a review from a team as a code owner January 9, 2024 19:41
@lqiu96 lqiu96 added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 9, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 9, 2024
@lqiu96 lqiu96 requested a review from blakeli0 January 9, 2024 19:41
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Jan 9, 2024
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: xl Pull request size is extra large. labels Jan 12, 2024
Copy link

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions

52.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link

Quality Gate Failed Quality Gate failed for 'java_showcase_integration_tests'

Failed conditions

51.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@lqiu96 lqiu96 merged commit 097bc93 into main Jan 12, 2024
@lqiu96 lqiu96 deleted the validate-universe-domain branch January 12, 2024 20:13
lqiu96 added a commit that referenced this pull request Jan 17, 2024
* feat: Validate the universe domain

* chore: Merge in from origin/main

* chore: Add comments for ApiCallContext

* chore: Add comments

* chore: Address PR comments

* chore: Merge endpoint context in both transports

* chore: Use @throws for the exceptions

* chore: Provide a default EndpointContext

* chore: Address PR comments

* chore: Update error message

* chore: Address PR comments

* chore: Address PR comments

* chore: Address PR comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants