use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class R__CloudConfigMigration method migrateCloudIdentity.
private void migrateCloudIdentity(Collection<CloudIdentity> entities, Connection connection) throws SQLException {
logger.debug("Starting migration for CloudConfig-->IdentityService");
String insert = "INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `PROJECT_DOMAIN_NAME`, `USER_DOMAIN_NAME`) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?);";
try (Statement stmt = connection.createStatement();
PreparedStatement ps = connection.prepareStatement(insert)) {
for (CloudIdentity cloudIdentity : entities) {
try (ResultSet rows = stmt.executeQuery("Select count(1) from identity_services where id='" + cloudIdentity.getId() + "'")) {
int count = 0;
while (rows.next()) {
count = rows.getInt(1);
}
if (count == 0) {
ps.setString(1, cloudIdentity.getId());
ps.setString(2, cloudIdentity.getIdentityUrl());
ps.setString(3, cloudIdentity.getMsoId());
ps.setString(4, cloudIdentity.getMsoPass());
ps.setString(5, cloudIdentity.getAdminTenant());
ps.setString(6, cloudIdentity.getMemberRole());
ps.setBoolean(7, cloudIdentity.getTenantMetadata());
ps.setString(8, cloudIdentity.getIdentityServerType() != null ? cloudIdentity.getIdentityServerType().name() : null);
ps.setString(9, cloudIdentity.getIdentityAuthenticationType() != null ? cloudIdentity.getIdentityAuthenticationType().name() : null);
ps.setString(10, FLYWAY);
ps.setString(11, cloudIdentity.getProjectDomainName());
ps.setString(12, cloudIdentity.getUserDomainName());
ps.executeUpdate();
}
}
}
}
}
use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class DeleteAAIInventory method heatbridge.
public void heatbridge(CloudInformation cloudInformation) throws MsoCloudSiteNotFound, HeatBridgeException {
logger.debug("Heatbridge delete executing");
CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId()).orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
if (cloudSite.getOrchestrator() != null && MULTICLOUD_MODE.equalsIgnoreCase(cloudSite.getOrchestrator())) {
logger.debug("Skipping Heatbridge as CloudSite orchestrator is: " + MULTICLOUD_MODE);
return;
}
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
HeatBridgeApi heatBridgeClient = createClient(getAaiClient(), cloudSite, cloudIdentity, cloudInformation);
heatBridgeClient.authenticate();
heatBridgeClient.deleteVfModuleData(cloudInformation.getVnfId(), cloudInformation.getVfModuleId());
}
use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class AuthenticationMethodTest method testCoreUsernamePasswordAuthFromCloudIdentity.
@Test
public void testCoreUsernamePasswordAuthFromCloudIdentity() {
CloudIdentity ci = new CloudIdentity();
ci.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD);
ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
ci.setMsoId("someuser");
Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci);
assertTrue(UsernamePassword.class.equals(auth.getClass()));
}
use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class AuthenticationMethodTest method testCoreUsernamePasswordAuth.
@Test
public void testCoreUsernamePasswordAuth() {
CloudIdentity ci = new CloudIdentity();
ci.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD);
ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
ci.setMsoId("someuser");
Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci);
assertTrue(UsernamePassword.class.equals(auth.getClass()));
}
use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class AuthenticationMethodTest method testCustomRackspaceAuthFromCloudIdentity.
@Test
public void testCustomRackspaceAuthFromCloudIdentity() {
CloudIdentity ci = new CloudIdentity();
ci.setIdentityAuthenticationType(AuthenticationType.RACKSPACE_APIKEY);
ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
ci.setMsoId("test");
Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci);
assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
}
Aggregations