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);
}
Aggregations