@@ -189,6 +189,16 @@ public class GoogleCloudStorageClientSettings {
189189 key -> Setting .simpleString (key , Setting .Property .NodeScope )
190190 );
191191
192+ /**
193+ * Whether to enable FIPS mode validation for the GCS client.
194+ * Set to false to bypass custom truststore check in FIPS-enabled environments.
195+ */
196+ static final Setting .AffixSetting <Boolean > FIPS_MODE_SETTING = Setting .affixKeySetting (
197+ PREFIX ,
198+ "fips.mode" ,
199+ key -> Setting .boolSetting (key , true , Setting .Property .NodeScope )
200+ );
201+
192202 /** The credentials used by the client to connect to the Storage endpoint. */
193203 private final ServiceAccountCredentials credential ;
194204
@@ -216,6 +226,12 @@ public class GoogleCloudStorageClientSettings {
216226 /** The GCS SDK Truststore settings. */
217227 private final TruststoreSettings truststoreSettings ;
218228
229+ /**
230+ * Whether to enforce FIPS mode validation for this GCS client.
231+ * When true and running in a FIPS-enabled JVM, a custom truststore must be configured.
232+ */
233+ private final boolean fipsMode ;
234+
219235 GoogleCloudStorageClientSettings (
220236 final ServiceAccountCredentials credential ,
221237 final String endpoint ,
@@ -225,7 +241,8 @@ public class GoogleCloudStorageClientSettings {
225241 final String applicationName ,
226242 final URI tokenUri ,
227243 final ProxySettings proxySettings ,
228- final TruststoreSettings truststoreSettings
244+ final TruststoreSettings truststoreSettings ,
245+ final boolean fipsMode
229246 ) {
230247 this .credential = credential ;
231248 this .endpoint = endpoint ;
@@ -236,6 +253,7 @@ public class GoogleCloudStorageClientSettings {
236253 this .tokenUri = tokenUri ;
237254 this .proxySettings = proxySettings ;
238255 this .truststoreSettings = truststoreSettings ;
256+ this .fipsMode = fipsMode ;
239257 }
240258
241259 public ServiceAccountCredentials getCredential () {
@@ -297,7 +315,8 @@ static GoogleCloudStorageClientSettings getClientSettings(final Settings setting
297315 getConfigValue (settings , clientName , APPLICATION_NAME_SETTING ),
298316 getConfigValue (settings , clientName , TOKEN_URI_SETTING ),
299317 validateAndCreateProxySettings (settings , clientName ),
300- validateAndCreateTruststoreSettings (settings , clientName )
318+ validateAndCreateTruststoreSettings (settings , clientName ),
319+ getConfigValue (settings , clientName , FIPS_MODE_SETTING )
301320 );
302321 }
303322
@@ -397,4 +416,12 @@ private static <T> T getConfigValue(final Settings settings, final String client
397416 final Setting <T > concreteSetting = clientSetting .getConcreteSettingForNamespace (clientName );
398417 return concreteSetting .get (settings );
399418 }
419+
420+ /**
421+ * Returns whether FIPS mode validation is enabled for this client.
422+ * @return true if FIPS mode validation is enabled, false otherwise
423+ */
424+ public boolean isFipsMode () {
425+ return fipsMode ;
426+ }
400427}
0 commit comments