Skip to content
Open
Changes from all commits
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 @@ -64,6 +64,7 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -113,6 +114,10 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
private static final boolean DIRECT_PATH_ENABLED =
Boolean.parseBoolean(System.getenv("CBT_ENABLE_DIRECTPATH"));

// If true, disable the bound-token-by-default feature for DirectPath.
private static final boolean DIRECT_PATH_BOUND_TOKEN_DISABLED =
Boolean.parseBoolean(System.getenv("CBT_DISABLE_DIRECTPATH_BOUND_TOKEN"));

private static final boolean SKIP_TRAILERS =
Optional.ofNullable(System.getenv("CBT_SKIP_HEADERS"))
.map(Boolean::parseBoolean)
Expand Down Expand Up @@ -440,6 +445,12 @@ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProvi
.setAttemptDirectPath(true)
// Allow using non-default service account in DirectPath.
.setAllowNonDefaultServiceAccount(true);
if (!DIRECT_PATH_BOUND_TOKEN_DISABLED) {
// Try to fetch a hard-bound access token for direct access if the runtime
// environment supports it.
grpcTransportProviderBuilder.setAllowHardBoundTokenTypes(
Collections.singletonList(InstantiatingGrpcChannelProvider.HardBoundTokenTypes.ALTS));
}
}
return grpcTransportProviderBuilder
.setChannelPoolSettings(
Expand Down
Loading