Skip to content

Commit 38fa277

Browse files
committed
feat: enable ALTS hard bound token in DirectPath
1 parent 20a3d0d commit 38fa277

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
import java.nio.charset.Charset;
194194
import java.nio.charset.StandardCharsets;
195195
import java.time.Duration;
196+
import java.util.Arrays;
196197
import java.util.Comparator;
197198
import java.util.HashMap;
198199
import java.util.List;
@@ -368,6 +369,9 @@ public GapicSpannerRpc(final SpannerOptions options) {
368369
boolean isAttemptDirectPathXds = Boolean.parseBoolean(directPathXdsEnv);
369370
if (isAttemptDirectPathXds) {
370371
defaultChannelProviderBuilder.setAttemptDirectPath(true);
372+
// This will let the credentials try to fetch a hard-bound access token if the runtime
373+
// environment supports it.
374+
defaultChannelProviderBuilder.setAllowHardBoundTokenTypes(Arrays.asList(InstantiatingGrpcChannelProvider.HardBoundTokenTypes.ALTS));
371375
defaultChannelProviderBuilder.setAttemptDirectPathXds();
372376
}
373377
if (options.isUseVirtualThreads()) {

0 commit comments

Comments
 (0)