@@ -134,6 +134,10 @@ public final class GrpcStorageOptions extends StorageOptions
134134 private static final String GCS_SCOPE = "https://www.googleapis.com/auth/devstorage.full_control" ;
135135 private static final Set <String > SCOPES = ImmutableSet .of (GCS_SCOPE );
136136 private static final String DEFAULT_HOST = "https://storage.googleapis.com" ;
137+ // If true, disable the bound-token-by-default feature for DirectPath.
138+ private static final boolean DIRECT_PATH_BOUND_TOKEN_DISABLED =
139+ Boolean .parseBoolean (
140+ System .getProperty ("com.google.cloud.storage.grpc.bound_token" , "false" ));
137141
138142 private final GrpcRetryAlgorithmManager retryAlgorithmManager ;
139143 private final java .time .Duration terminationAwaitDuration ;
@@ -318,10 +322,12 @@ private Tuple<StorageSettings, Opts<UserProject>> resolveSettingsAndOpts() throw
318322 InstantiatingGrpcChannelProvider .newBuilder ()
319323 .setEndpoint (endpoint )
320324 .setAllowNonDefaultServiceAccount (true )
321- .setAttemptDirectPath (attemptDirectPath )
322- .setAllowHardBoundTokenTypes (
323- Collections .singletonList (
324- InstantiatingGrpcChannelProvider .HardBoundTokenTypes .ALTS ));
325+ .setAttemptDirectPath (attemptDirectPath );
326+
327+ if (!DIRECT_PATH_BOUND_TOKEN_DISABLED ) {
328+ channelProviderBuilder .setAllowHardBoundTokenTypes (
329+ Collections .singletonList (InstantiatingGrpcChannelProvider .HardBoundTokenTypes .ALTS ));
330+ }
325331
326332 if (!NoopGrpcInterceptorProvider .INSTANCE .equals (grpcInterceptorProvider )) {
327333 channelProviderBuilder .setInterceptorProvider (grpcInterceptorProvider );
0 commit comments