use of com.emc.storageos.model.tenant.UserMappingParam in project coprhd-controller by CoprHD.
the class KeystoneUtils method prepareUserMappings.
/**
* Prepares userMappings with OpenStack Tenant ID for CoprHD Tenant.
*
* @param openstackId OpenStack Tenant ID.
* @return UserMappings.
*/
public List<UserMappingParam> prepareUserMappings(String openstackId) {
AuthnProvider provider = getKeystoneProvider();
// Create mapping rules
List<UserMappingParam> userMappings = new ArrayList<>();
List<String> values = new ArrayList<>();
values.add(openstackId);
List<UserMappingAttributeParam> attributes = new ArrayList<>();
attributes.add(new UserMappingAttributeParam(KeystoneUtils.OPENSTACK_TENANT_ID, values));
userMappings.add(new UserMappingParam(provider.getDomains().iterator().next(), attributes, new ArrayList<String>()));
return userMappings;
}
use of com.emc.storageos.model.tenant.UserMappingParam in project coprhd-controller by CoprHD.
the class KeystoneUtilsTest method testPrepareUserMappings.
@Test
public void testPrepareUserMappings() {
KeystoneUtils spyKeystoneUtils = spy(_keystoneUtils);
doReturn(keystoneProvider).when(spyKeystoneUtils).getKeystoneProvider();
List<UserMappingParam> createdUserMapping = spyKeystoneUtils.prepareUserMappings(TENANT_OS_ID);
UserMappingParam expectedParams = userMappings.iterator().next();
UserMappingParam createdParams = createdUserMapping.iterator().next();
assertEquals(expectedParams.getDomain(), createdParams.getDomain());
assertEquals(expectedParams.getAttributes(), createdParams.getAttributes());
assertEquals(expectedParams.getGroups(), createdParams.getGroups());
}
use of com.emc.storageos.model.tenant.UserMappingParam in project coprhd-controller by CoprHD.
the class KeystoneUtilsTest method prepareUserMapping.
private void prepareUserMapping() {
userMappings = new ArrayList<>();
List<String> values = new ArrayList<>();
values.add(TENANT_OS_ID);
List<UserMappingAttributeParam> attributes = new ArrayList<>();
attributes.add(new UserMappingAttributeParam(KeystoneUtils.OPENSTACK_TENANT_ID, values));
userMappings.add(new UserMappingParam(PROVIDER_DOMAIN, attributes, new ArrayList<>()));
}
use of com.emc.storageos.model.tenant.UserMappingParam in project coprhd-controller by CoprHD.
the class TenantModificationTest method securityAdminModifyUserMapping.
@Test
public void securityAdminModifyUserMapping() throws Exception {
TenantUpdateParam tenantUpdateParam = new TenantUpdateParam();
UserMappingChanges changes = new UserMappingChanges();
List<UserMappingParam> listAdd = new ArrayList<UserMappingParam>();
UserMappingParam param = new UserMappingParam();
param.setDomain("Not Exist");
listAdd.add(param);
changes.setAdd(listAdd);
tenantUpdateParam.setUserMappingChanges(changes);
try {
secAdminClient.tenants().update(rootTenantID, tenantUpdateParam);
Assert.fail("fail, as the input contains wrong domain");
} 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.model.tenant.UserMappingParam in project coprhd-controller by CoprHD.
the class FilePolicyApiTest method getDefaultUserMappingParam.
private UserMappingParam getDefaultUserMappingParam() {
UserMappingParam param = new UserMappingParam();
param.setDomain(getTestDomainName());
param.getGroups().add(apiTestAuthnProviderUtils.getLDAPGroup(2));
return param;
}
Aggregations