summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main/java/org
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2020-06-09 13:48:52 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-06-09 13:48:58 -0400
commita809a724bbcf527f791c68d8b1d70ea6e839c314 (patch)
tree1a79002828007ff89ed01cf2cbb8760609f7a5cf /adapters/mso-openstack-adapters/src/main/java/org
parent515be95fb12dcecf7cffb9f8fac6db853907d329 (diff)
Fix Heatbridge auth for Keystone-v3
Fix Heatbridge auth for Keystone-v3 Issue-ID: SO-2980 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Idacce2beebde14f43817ada59fb0d593504c6bdd
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java/org')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java15
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java4
5 files changed, 18 insertions, 9 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 32cd92d70e..53736e912f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -145,7 +145,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
logger.trace("Keystone Version: {} ", keystoneVersion);
this.osClient = new MsoCloudClientFactoryImpl(new OpenstackClientFactoryImpl()).getOpenstackClient(
cloudIdentity.getIdentityUrl(), cloudIdentity.getMsoId(), cloudIdentity.getMsoPass(), regionId,
- tenantId, keystoneVersion);
+ tenantId, keystoneVersion, cloudIdentity.getUserDomainName(), cloudIdentity.getProjectDomainName());
logger.trace("Successfully authenticated with keystone for tenant: {} and region: {}", tenantId, regionId);
return osClient;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
index a9a63b312d..3c209314f3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
@@ -55,5 +55,5 @@ public interface MsoCloudClientFactory {
OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String regionId, String tenantId,
- String keystoneVersion) throws HeatBridgeException;
+ String keystoneVersion, String userDomainName, String projectDomainName) throws HeatBridgeException;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
index 88a7d3dbbc..e299f6ffb8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
@@ -64,21 +64,26 @@ public class MsoCloudClientFactoryImpl implements MsoCloudClientFactory {
@Override
public OpenstackClient getOpenstackClient(@Nonnull String url, @Nonnull String msoId, @Nonnull String msoPass,
- @Nonnull String regionId, @Nonnull String tenantId, @Nonnull String keystoneVersion)
- throws HeatBridgeException {
+ @Nonnull String regionId, @Nonnull String tenantId, @Nonnull String keystoneVersion, String userDomainName,
+ String projectDomainName) throws HeatBridgeException {
Objects.requireNonNull(url, "Null openstack url!");
Objects.requireNonNull(msoId, "Null openstack user id!");
Objects.requireNonNull(msoPass, "Null openstack password!");
Objects.requireNonNull(regionId, "Null regionId ID!");
Objects.requireNonNull(tenantId, "Null tenant ID!");
- Objects.requireNonNull(tenantId, "Null keystone version");
+ Objects.requireNonNull(keystoneVersion, "Null keystone version");
+ if (userDomainName == null) {
+ userDomainName = HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME;
+ }
+ if (projectDomainName == null) {
+ projectDomainName = HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME;
+ }
try {
final OpenstackAccess osAccess = new OpenstackAccessBuilder().setBaseUrl(url) // keystone URL
.setUser(msoId) // keystone username
.setPassword(CryptoUtils.decryptCloudConfigPassword(msoPass)) // keystone decrypted password
.setRegion(regionId) // openstack region
- .setDomainName(HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME) // hardcode to "default"
- .setTenantId(tenantId) // tenantId
+ .setDomainName(userDomainName).setProjectName(projectDomainName).setTenantId(tenantId) // tenantId
.build();
// Identify the Keystone version
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
index 69c76fad84..d8f2ee7273 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
@@ -88,6 +88,10 @@ public class OpenstackAccess {
return projectName;
}
+ public Identifier getProjectNameIdentifier() {
+ return Identifier.byName(projectName);
+ }
+
public static class OpenstackAccessBuilder {
private String baseUrl;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
index bbcd54e6f8..8829c702cf 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
@@ -62,8 +62,8 @@ public class OpenstackClientFactoryImpl implements OpenstackClientFactory {
try {
client = OSFactory.builderV3().endpoint(osAccess.getUrl())
.credentials(osAccess.getUser(), osAccess.getPassword(), osAccess.getDomainNameIdentifier())
- .scopeToProject(Identifier.byId(osAccess.getTenantId())).authenticate()
- .useRegion(osAccess.getRegion());
+ .scopeToProject(Identifier.byId(osAccess.getTenantId()), osAccess.getProjectNameIdentifier())
+ .authenticate().useRegion(osAccess.getRegion());
return new OpenstackV3ClientImpl(client);
} catch (AuthenticationException exception) {
throw new OpenstackClientException("Failed to authenticate with Keystone-v3: " + osAccess.getUrl(),