Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit d62322c

Browse files
Max Smileygaul
authored andcommitted
Fix ContextBuilder bug when using credentials supplier with azureblob
1 parent 6ef293d commit d62322c

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

core/src/main/java/org/jclouds/ContextBuilder.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import org.jclouds.providers.config.BindProviderMetadataContextAndCredentials;
7575
import org.jclouds.providers.internal.UpdateProviderMetadataFromProperties;
7676
import org.jclouds.reflect.Invocation;
77+
import org.jclouds.rest.ApiContext;
7778
import org.jclouds.rest.ConfiguresCredentialStore;
7879
import org.jclouds.rest.ConfiguresHttpApi;
7980
import org.jclouds.rest.HttpApiMetadata;
@@ -364,10 +365,16 @@ private Properties currentStateToUnexpandedProperties() {
364365
defaults.setProperty(PROPERTY_API, apiMetadata.getName());
365366
defaults.setProperty(PROPERTY_API_VERSION, apiVersion);
366367
defaults.setProperty(PROPERTY_BUILD_VERSION, buildVersion);
367-
if (identity.isPresent())
368-
defaults.setProperty(PROPERTY_IDENTITY, identity.get());
369-
if (credential != null)
370-
defaults.setProperty(PROPERTY_CREDENTIAL, credential);
368+
if (credentialsSupplierOption.isPresent()) {
369+
Credentials credentials = credentialsSupplierOption.get().get();
370+
defaults.setProperty(PROPERTY_IDENTITY, credentials.identity);
371+
defaults.setProperty(PROPERTY_CREDENTIAL, credentials.credential);
372+
} else {
373+
if (identity.isPresent())
374+
defaults.setProperty(PROPERTY_IDENTITY, identity.get());
375+
if (credential != null)
376+
defaults.setProperty(PROPERTY_CREDENTIAL, credential);
377+
}
371378
if (overrides.isPresent())
372379
putAllAsString(overrides.get(), defaults);
373380
putAllAsString(propertiesPrefixedWithJcloudsApiOrProviderId(getSystemProperties(), apiMetadata.getId(), providerId), defaults);

0 commit comments

Comments
 (0)