|
74 | 74 | import org.jclouds.providers.config.BindProviderMetadataContextAndCredentials; |
75 | 75 | import org.jclouds.providers.internal.UpdateProviderMetadataFromProperties; |
76 | 76 | import org.jclouds.reflect.Invocation; |
| 77 | +import org.jclouds.rest.ApiContext; |
77 | 78 | import org.jclouds.rest.ConfiguresCredentialStore; |
78 | 79 | import org.jclouds.rest.ConfiguresHttpApi; |
79 | 80 | import org.jclouds.rest.HttpApiMetadata; |
@@ -364,10 +365,16 @@ private Properties currentStateToUnexpandedProperties() { |
364 | 365 | defaults.setProperty(PROPERTY_API, apiMetadata.getName()); |
365 | 366 | defaults.setProperty(PROPERTY_API_VERSION, apiVersion); |
366 | 367 | 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 | + } |
371 | 378 | if (overrides.isPresent()) |
372 | 379 | putAllAsString(overrides.get(), defaults); |
373 | 380 | putAllAsString(propertiesPrefixedWithJcloudsApiOrProviderId(getSystemProperties(), apiMetadata.getId(), providerId), defaults); |
|
0 commit comments