Skip to content

feat: enable ALTS hard bound token in DirectPath #3645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 4, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -368,6 +369,9 @@ public GapicSpannerRpc(final SpannerOptions options) {
boolean isAttemptDirectPathXds = Boolean.parseBoolean(directPathXdsEnv);
if (isAttemptDirectPathXds) {
defaultChannelProviderBuilder.setAttemptDirectPath(true);
// This will let the credentials try to fetch a hard-bound access token if the runtime
// environment supports it.
defaultChannelProviderBuilder.setAllowHardBoundTokenTypes(Arrays.asList(InstantiatingGrpcChannelProvider.HardBoundTokenTypes.ALTS));
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: When you have single value, you can use Collections.singletonList

Copy link
Collaborator

Choose a reason for hiding this comment

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

format the code using the following command

mvn com.coveo:fmt-maven-plugin:format

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for the tips! Done.

defaultChannelProviderBuilder.setAttemptDirectPathXds();
}
if (options.isUseVirtualThreads()) {
Expand Down
Loading