Skip to content

Complete CallCredentials support in gRPC webclient#2

Draft
MariusVolkhart wants to merge 1 commit into
mv/deadlinesfrom
mv/callCredentials
Draft

Complete CallCredentials support in gRPC webclient#2
MariusVolkhart wants to merge 1 commit into
mv/deadlinesfrom
mv/callCredentials

Conversation

@MariusVolkhart

Copy link
Copy Markdown
Owner

Summary

The CallCredentials API on GrpcServiceDescriptor and GrpcClientMethodDescriptor was introduced
in helidon-io#8423 with builder support and Javadoc describing override semantics, but was never wired through
to outgoing RPCs. GrpcServiceClientImpl.ensureMethod() always passed CallOptions.DEFAULT, and
GrpcBaseClientCall.start() never read callOptions.getCredentials(). Credentials configured via
either the native Helidon API or stub.withCallCredentials() were silently discarded.

  • GrpcServiceClientImpl.ensureMethod() now resolves credentials from the descriptor chain
    (method-level overrides service-level) and injects them into CallOptions.
  • GrpcBaseClientCall.start() applies callOptions.getCredentials() before writeHeaders, using a
    CompletableFuture to bridge the async MetadataApplier callback to the blocking call path.
    Timeout is derived from the call deadline when set, falling back to pollWaitTime.
  • A startFailed flag guards subclass stream I/O methods against use after start() exits early.

Fixes helidon-io#11741
Relates to helidon-io#10527

Note: This PR is based on helidon-io#11699 (mv/deadlines), which adds deadline propagation support.
CallCredentials timeout resolution depends on callOptions.getDeadline() introduced there.

Documentation

New API surface: none. GrpcServiceDescriptor.callCredentials() and
GrpcClientMethodDescriptor.callCredentials() already exist. This change makes them functional.

Users who authenticate gRPC calls via ClientInterceptor are unaffected. Users who configure
CallCredentials on service/method descriptors or via stub.withCallCredentials() will now see
those credentials applied to outgoing RPCs, consistent with grpc-java behavior.

The CallCredentials API on GrpcServiceDescriptor and
GrpcClientMethodDescriptor was introduced in helidon-io#8423 with builder support
and Javadoc describing override semantics, but was never wired through
to outgoing RPCs. GrpcServiceClientImpl.ensureMethod() always passed
CallOptions.DEFAULT, and GrpcBaseClientCall.start() never read
callOptions.getCredentials(). Credentials configured via either the
native Helidon API or stub.withCallCredentials() were silently
discarded.

GrpcServiceClientImpl.ensureMethod() now resolves credentials from the
descriptor chain (method-level overrides service-level) and injects them
into CallOptions. GrpcBaseClientCall.start() applies
callOptions.getCredentials() before writeHeaders, using a
CompletableFuture to bridge the async MetadataApplier callback to the
blocking call path. Timeout is derived from the call deadline when set,
falling back to pollWaitTime. A startFailed flag guards subclass stream
I/O methods against use after start() exits early.

Fixes helidon-io#11741
Relates to helidon-io#10527
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.

1 participant