use of com.emc.storageos.usermanagement.util.ViPRClientHelper in project coprhd-controller by CoprHD.
the class TenantModificationTest method providerTenantAdminCreateTenant.
@Test
public void providerTenantAdminCreateTenant() throws Exception {
ViPRClientHelper viPRClientHelper1 = new ViPRClientHelper(tenantAdminClient);
try {
viPRClientHelper1.createTenant("testTenant", "secqe.com", "attr", "value");
Assert.fail("Provider tenant's TenantAdmin should has no permision to create subtenant");
} catch (ServiceErrorException see) {
Assert.assertEquals(see.getCode(), 3000);
Assert.assertTrue(see.getMessage().contains("Insufficient permissions"));
}
}
use of com.emc.storageos.usermanagement.util.ViPRClientHelper in project coprhd-controller by CoprHD.
the class TenantMode method setupTenantModeBaseClass.
@BeforeClass
public static synchronized void setupTenantModeBaseClass() throws Exception {
rootTenantID = superUserClient.getUserTenantId();
viPRClientHelper = new ViPRClientHelper(superUserClient);
// keep root tenant's user mapping, will restore it in teardown method
viPRClientHelper.addRoleAssignment(rootTenantID, superUser, RoleOrAcl.TenantAdmin.toString());
oldRootTenantUserMappingList = viPRClientHelper.removeTenantUserMapping(rootTenantID);
}
use of com.emc.storageos.usermanagement.util.ViPRClientHelper in project coprhd-controller by CoprHD.
the class TenantModificationTest method securityAdminCreateTenant.
@Test
public void securityAdminCreateTenant() throws Exception {
ViPRClientHelper viPRClientHelper1 = new ViPRClientHelper(secAdminClient);
try {
viPRClientHelper1.createTenant("testTenant", "not-exist.com", "attr", "value");
Assert.fail("should fail, as input domain not exist");
} catch (ServiceErrorException see) {
// verify the exception is not insufficent permission.
Assert.assertNotEquals(see.getCode(), 3000);
Assert.assertTrue(see.getMessage().contains("Parameter was provided but invalid"));
}
}
use of com.emc.storageos.usermanagement.util.ViPRClientHelper in project coprhd-controller by CoprHD.
the class ADMode method setupADModeBaseClass.
@BeforeClass
public static synchronized void setupADModeBaseClass() throws Exception {
// get super user from parameter, better be AD user
superUser = System.getProperty("SUPER_USER");
superUserPassword = System.getProperty("SUPER_USER_PASSWORD");
if (superUser == null || superUserPassword == null) {
Properties properties = new Properties();
properties.load(ClassLoader.class.getResourceAsStream("/test-env.conf"));
superUser = properties.getProperty("SUPER_USER");
superUserPassword = properties.getProperty("SUPER_USER_PASSWORD");
}
logger.info("security admin: " + superUser + "/" + superUserPassword);
superUserClient = new ViPRCoreClient(controllerNodeEndpoint, true).withLogin(superUser, superUserPassword);
ViPRClientHelper helper = new ViPRClientHelper(superUserClient);
InputStream adFileInputStream = ClassLoader.class.getResourceAsStream(adFile);
AuthnCreateParam input = XmlUtil.unmarshal(adFileInputStream, AuthnCreateParam.class);
// for future cleanup, if not exit before the test.
bAuthnProviderExisted = helper.isAuthnProviderExisted(input);
// createAuthnProvider will skip creating one, if it already existed
authnProviderRestRep = helper.createAuthnProvider(input);
// construct ldapClient, which will be used for creating users on AD server.
String serverUrl = (String) input.getServerUrls().toArray()[0];
String domain = (String) input.getDomains().toArray()[0];
adClient = new ADClient(serverUrl, input.getManagerDn(), input.getManagerPassword(), domain);
}
use of com.emc.storageos.usermanagement.util.ViPRClientHelper in project coprhd-controller by CoprHD.
the class GeoMode method setupGeoTenantModeBase.
@BeforeClass
public static void setupGeoTenantModeBase() throws Exception {
VirtualDataCenters vdcs = superUserClient.vdcs();
List<NamedRelatedResourceRep> list = vdcs.list();
for (NamedRelatedResourceRep vdc : list) {
VirtualDataCenterRestRep restRep = superUserClient.vdcs().get(vdc.getId());
vdcList.add(restRep);
}
if (vdcList.size() < 2) {
String errorMsg = "env check fail, only one VDC, Geo test need at least 2 vdcs";
logger.error(errorMsg);
throw new Exception(errorMsg);
}
logger.info("grant " + superUser + " security admin in both VDCs");
ViPRCoreClient vdc1RootClient = new ViPRCoreClient(getVdcEndpointByIndex(0), true).withLogin("root", rootPassword);
ViPRClientHelper vdc1Helper = new ViPRClientHelper(vdc1RootClient);
vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SecurityAdmin.toString());
vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemAdmin.toString());
vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemMonitor.toString());
vdc1RootClient.auth().logout();
ViPRCoreClient vdc2RootClient = new ViPRCoreClient(getVdcEndpointByIndex(1), true).withLogin("root", rootPassword);
ViPRClientHelper vdc2Helper = new ViPRClientHelper(vdc2RootClient);
vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SecurityAdmin.toString());
vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemAdmin.toString());
vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemMonitor.toString());
vdc2RootClient.auth().logout();
}
Aggregations