Search in sources :

Example 16 with AuthnProviderRestRep

use of com.emc.storageos.model.auth.AuthnProviderRestRep in project coprhd-controller by CoprHD.

the class Tenants method addRenderArgs.

@Util
private static void addRenderArgs(TenantForm tenant) {
    List<String> domains = Lists.newArrayList();
    for (AuthnProviderRestRep authProvider : AuthnProviderUtils.getAuthnProviders()) {
        if (!authProvider.getDisable()) {
            domains.addAll(authProvider.getDomains());
        }
    }
    Gson g = new Gson();
    renderArgs.put("domainsJson", g.toJson(domains));
    List<StringOption> allNamespace = TenantUtils.getUnmappedNamespace();
    renderArgs.put("namespaceOptions", allNamespace);
}
Also used : Gson(com.google.gson.Gson) AuthnProviderRestRep(com.emc.storageos.model.auth.AuthnProviderRestRep) Util(play.mvc.Util)

Example 17 with AuthnProviderRestRep

use of com.emc.storageos.model.auth.AuthnProviderRestRep in project coprhd-controller by CoprHD.

the class ACLUtils method validateActiveDirectoryGroupName.

public static boolean validateActiveDirectoryGroupName(String name) {
    if (StringUtils.isNotBlank(name)) {
        String group = stripDomainName(name);
        String domain = extractDomainName(name);
        if (StringUtils.isNotBlank(group) && StringUtils.isNotBlank(domain)) {
            List<AuthnProviderRestRep> authnProviderRestReps = AuthnProviderUtils.getAuthProvidersByDomainName(domain);
            for (AuthnProviderRestRep authnProviderRestRep : authnProviderRestReps) {
                if (isActiveDirectoryProvider(authnProviderRestRep) && isGroupOnWhiteList(authnProviderRestRep.getGroupWhitelistValues(), group)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : AuthnProviderRestRep(com.emc.storageos.model.auth.AuthnProviderRestRep)

Example 18 with AuthnProviderRestRep

use of com.emc.storageos.model.auth.AuthnProviderRestRep in project coprhd-controller by CoprHD.

the class TrustStoreTest method addResourcesShouldSucceed.

/**
 */
private void addResourcesShouldSucceed() {
    resourcesToRemove = new ArrayList<RestLinkRep>();
    ClientResponse response = addLDAPSAuthProvider();
    Assert.assertEquals(200, response.getStatus());
    AuthnProviderRestRep authnResp = response.getEntity(AuthnProviderRestRep.class);
    Assert.assertNotNull(authnResp);
    resourcesToRemove.add(authnResp.getLink());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) RestLinkRep(com.emc.storageos.model.RestLinkRep) AuthnProviderRestRep(com.emc.storageos.model.auth.AuthnProviderRestRep)

Example 19 with AuthnProviderRestRep

use of com.emc.storageos.model.auth.AuthnProviderRestRep in project coprhd-controller by CoprHD.

the class Tenants method list.

public static void list() {
    TenantsDataTable dataTable = new TenantsDataTable();
    renderArgs.put("sources", TenantSource.options(TenantSource.TENANTS_SOURCE_ALL, TenantSource.TENANTS_SOURCE_LOCAL, TenantSource.TENANTS_SOURCE_OS));
    renderArgs.put("currentSource", Models.currentSource());
    if (isKeystoneAuthnProviderCreated()) {
        AuthnProviderRestRep authnProvider = AuthnProviderUtils.getKeystoneAuthProvider();
        authnProviderName = authnProvider.getName();
        TenantsSyncOptionsForm keystoneProvider = new TenantsSyncOptionsForm();
        keystoneProvider.readFrom(authnProvider);
        renderArgs.put("tenantsOptions", TenantsSynchronizationOptions.options(TenantsSynchronizationOptions.ADDITION, TenantsSynchronizationOptions.DELETION));
        renderArgs.put("interval", getInterval(authnProvider));
        renderArgs.put("osTenantsToAdd", new KeystoneSynchronizationTenantsDataTable());
        renderArgs.put("osTenantsToRemove", new KeystoneSynchronizationTenantsDataTable());
        render(dataTable, keystoneProvider);
    }
    render(dataTable);
}
Also used : TenantsDataTable(models.datatable.TenantsDataTable) OpenStackTenantsDataTable(models.datatable.OpenStackTenantsDataTable) AuthnProviderRestRep(com.emc.storageos.model.auth.AuthnProviderRestRep)

Example 20 with AuthnProviderRestRep

use of com.emc.storageos.model.auth.AuthnProviderRestRep in project coprhd-controller by CoprHD.

the class LDAPsources method save.

@FlashException(keep = true)
public static void save(LDAPsourcesForm ldapSources) {
    ldapSources.validate("ldapSources");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    AuthnProviderRestRep authnProvider = ldapSources.save();
    authProviderName = ldapSources.name;
    flash.success(MessagesUtils.get(SAVED, ldapSources.name));
    if (ldapSources.autoRegCoprHDNImportOSProjects && !authProviderAutoReg) {
        renderArgs.put("showDialog", "true");
        edit(new LDAPsourcesForm(authnProvider));
    }
    list();
}
Also used : AuthnProviderRestRep(com.emc.storageos.model.auth.AuthnProviderRestRep) FlashException(controllers.util.FlashException)

Aggregations

AuthnProviderRestRep (com.emc.storageos.model.auth.AuthnProviderRestRep)29 AuthnCreateParam (com.emc.storageos.model.auth.AuthnCreateParam)18 AuthnUpdateParam (com.emc.storageos.model.auth.AuthnUpdateParam)12 ClientResponse (com.sun.jersey.api.client.ClientResponse)11 Test (org.junit.Test)11 FlashException (controllers.util.FlashException)2 RestLinkRep (com.emc.storageos.model.RestLinkRep)1 AuthnProviderList (com.emc.storageos.model.auth.AuthnProviderList)1 TenantCreateParam (com.emc.storageos.model.tenant.TenantCreateParam)1 UserMappingAttributeParam (com.emc.storageos.model.tenant.UserMappingAttributeParam)1 UserMappingParam (com.emc.storageos.model.tenant.UserMappingParam)1 Gson (com.google.gson.Gson)1 ClientHandlerException (com.sun.jersey.api.client.ClientHandlerException)1 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)1 URI (java.net.URI)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Random (java.util.Random)1 OpenStackTenantsDataTable (models.datatable.OpenStackTenantsDataTable)1