Search in sources :

Example 1 with ADClient

use of com.emc.storageos.usermanagement.util.ad.ADClient 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);
}
Also used : ADClient(com.emc.storageos.usermanagement.util.ad.ADClient) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) InputStream(java.io.InputStream) AuthnCreateParam(com.emc.storageos.model.auth.AuthnCreateParam) Properties(java.util.Properties) ViPRClientHelper(com.emc.storageos.usermanagement.util.ViPRClientHelper) BeforeClass(org.junit.BeforeClass)

Aggregations

AuthnCreateParam (com.emc.storageos.model.auth.AuthnCreateParam)1 ViPRClientHelper (com.emc.storageos.usermanagement.util.ViPRClientHelper)1 ADClient (com.emc.storageos.usermanagement.util.ad.ADClient)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 InputStream (java.io.InputStream)1 Properties (java.util.Properties)1 BeforeClass (org.junit.BeforeClass)1