Skip to content

support dual credentials in google_default_credentials#39770

Closed
anniefrchz wants to merge 23 commits intogrpc:masterfrom
anniefrchz:directpath2
Closed

support dual credentials in google_default_credentials#39770
anniefrchz wants to merge 23 commits intogrpc:masterfrom
anniefrchz:directpath2

Conversation

@anniefrchz
Copy link
Contributor

No description provided.

@anniefrchz anniefrchz self-assigned this Jun 5, 2025
@anniefrchz anniefrchz requested a review from rockspore June 5, 2025 22:39
@anniefrchz anniefrchz added the release notes: no Indicates if PR should not be in release notes label Jun 5, 2025
Copy link
Contributor

@rockspore rockspore left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR! Mostly LGTM. Left a few minor comments.

}

grpc_channel_credentials*
grpc_google_default_credentials_create_with_dual_call_credentials(
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this New API. Instead we can modify the existing grpc_google_default_credentials_create by adding a second argument, which can default to nullptr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME,
GRPC_ALTS_TRANSPORT_SECURITY_TYPE);
tls_creds_ = MakeRefCounted<grpc_md_only_test_credentials>(
GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME, "tls");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You could use GRPC_TLS_TRANSPORT_SECURITY_TYPE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

GRPC_ALTS_TRANSPORT_SECURITY_TYPE);
tls_creds_ = MakeRefCounted<grpc_md_only_test_credentials>(
GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME, "tls");
dual_creds_ = MakeRefCounted<DualCallCredentials>(tls_creds_->Ref(),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could we call the google_default_..._create API to make the coverage slightly more thorough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

grpc_call_credentials* call_credentials);

GRPCAPI grpc_channel_credentials*
grpc_google_default_credentials_create_with_dual_call_credentials(
Copy link
Contributor

Choose a reason for hiding this comment

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

We can just modify the API above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Becase this is a backwards compatible C API, we cannot use default arguments so we need ot create the second API with 2 arguments regardless.

rockspore
rockspore previously approved these changes Jun 10, 2025
Copy link
Contributor

@rockspore rockspore left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM. Adding @markdroth to take a pass since we touched the grpc_google_default_credentials_create API.

mechanism.

The caller may specify a secondary alts credentials objects to attach to the
channel for ALTS connections. Whenever the channel connection require them,
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably more accurate to say: if an alts credentials object is specified, it will be used if the underlying channel type is alts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@rockspore rockspore requested a review from markdroth June 10, 2025 00:46
@rockspore
Copy link
Contributor

Please fix the following failure:

/var/local/jenkins/grpc/src/cpp/client/secure_credentials.cc
  /var/local/jenkins/grpc/src/cpp/client/secure_credentials.cc:89:7: error: no matching function for call to 'grpc_google_default_credentials_create'
        grpc_google_default_credentials_create(nullptr));

from the failings tests, e.g. https://source.cloud.google.com/results/invocations/2a220610-2ab8-4a1e-a0e9-0574492772cf

@rockspore rockspore self-requested a review June 10, 2025 00:48
@rockspore rockspore dismissed their stale review June 10, 2025 00:49

Tests are failing.

@anniefrchz anniefrchz marked this pull request as draft June 10, 2025 21:51
@anniefrchz anniefrchz requested a review from rockspore June 23, 2025 17:50
@anniefrchz anniefrchz marked this pull request as ready for review June 23, 2025 17:51
Copy link
Contributor

@rockspore rockspore left a comment

Choose a reason for hiding this comment

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

Thanks for the refactoring effort! Some minor comments.

@anniefrchz anniefrchz requested a review from rockspore June 23, 2025 21:44
Copy link
Contributor

@rockspore rockspore left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM.

Copy link
Member

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

This looks much better! Just a few remaining comments, all fairly minor.

Copy link
Member

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Looks great!

anniefrchz added a commit to anniefrchz/grpc that referenced this pull request Jun 25, 2025
Closes grpc#39770

COPYBARA_INTEGRATE_REVIEW=grpc#39770 from anniefrchz:directpath2 35c0f4f
PiperOrigin-RevId: 775501652
paulosjca pushed a commit to paulosjca/grpc that referenced this pull request Aug 23, 2025
Closes grpc#39770

COPYBARA_INTEGRATE_REVIEW=grpc#39770 from anniefrchz:directpath2 35c0f4f
PiperOrigin-RevId: 775501652
@anniefrchz anniefrchz deleted the directpath2 branch September 4, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants