use of org.wso2.identity.integration.common.clients.KeyStoreAdminClient in project product-is by wso2.
the class SPMetaDataTenantTestCase method restartTestServer.
@Test(testName = "metaDataTestcase", dependsOnMethods = "addSPMetadataForTenant")
public void restartTestServer() throws Exception {
super.init();
ServerConfigurationManager serverConfigurationManager = new ServerConfigurationManager(isServer);
serverConfigurationManager.restartGracefully();
super.init(TestUserMode.TENANT_ADMIN);
KeyStoreAdminClient keyStoreAdminClient = new KeyStoreAdminClient(backendURL, ADMIN_USERNAME, ADMIN_PASSWORD);
KeyStoreData[] keyStoreDataArray = keyStoreAdminClient.getKeyStores();
Assert.assertTrue(keyStoreDataArray != null && keyStoreDataArray.length > 0);
String[] storeEntries = keyStoreAdminClient.getStoreEntries("wso2-com.jks");
Assert.assertTrue(storeEntries != null && storeEntries.length > 0);
Assert.assertTrue(Arrays.asList(storeEntries).contains(CERT_ALIAS));
}
use of org.wso2.identity.integration.common.clients.KeyStoreAdminClient in project product-is by wso2.
the class SAMLQueryProfileTestCase method initiateTenant.
@BeforeTest
public void initiateTenant() throws Exception {
// Since all the requests sign with default wso2 key, upload that public key to tenants
super.init(TestUserMode.TENANT_ADMIN);
KeyStoreAdminClient keyStoreAdminClient = new KeyStoreAdminClient(backendURL, sessionCookie);
String filePath = FrameworkPathUtil.getSystemResourceLocation() + "keystores" + File.separator + "products" + File.separator + "wso2carbon.pem";
byte[] crt = Files.readAllBytes(Paths.get(filePath));
keyStoreAdminClient.importCertToStore("wso2carbon", crt, "wso2-com.jks");
}
use of org.wso2.identity.integration.common.clients.KeyStoreAdminClient in project product-is by wso2.
the class SPMetaDataTenantTestCase method addSPMetadataForTenant.
@Test(testName = "metaDataTestcase")
public void addSPMetadataForTenant() throws Exception {
String filePath = FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "IS" + File.separator + "saml" + File.separator + "sp-metadata.xml";
byte[] encoded = Files.readAllBytes(Paths.get(filePath));
String metadataXml = new String(encoded, StandardCharsets.UTF_8);
// Load the metadata file to the client.
SAMLSSOServiceProviderDTO samlssoServiceProviderDTO = ssoConfigServiceClient.uploadServiceProvider(metadataXml);
Assert.assertEquals(samlssoServiceProviderDTO.getIssuer(), ISSUER);
SAMLSSOServiceProviderDTO[] samlssoServiceProviderDTOs = ssoConfigServiceClient.getServiceProviders().getServiceProviders();
SAMLSSOServiceProviderDTO samlssoServiceProviderDTOGet = null;
for (SAMLSSOServiceProviderDTO serviceProviderDTO : samlssoServiceProviderDTOs) {
if (ISSUER.equals(serviceProviderDTO.getIssuer())) {
samlssoServiceProviderDTOGet = serviceProviderDTO;
}
}
Assert.assertNotNull(samlssoServiceProviderDTOGet);
Assert.assertEquals(samlssoServiceProviderDTOGet.getCertAlias(), CERT_ALIAS);
KeyStoreAdminClient keyStoreAdminClient = new KeyStoreAdminClient(backendURL, ADMIN_USERNAME, ADMIN_PASSWORD);
KeyStoreData[] keyStoreDataArray = keyStoreAdminClient.getKeyStores();
Assert.assertTrue(keyStoreDataArray != null && keyStoreDataArray.length > 0);
String[] storeEntries = keyStoreAdminClient.getStoreEntries("wso2-com.jks");
Assert.assertTrue(storeEntries != null && storeEntries.length > 0);
Assert.assertTrue(Arrays.asList(storeEntries).contains(CERT_ALIAS));
}
Aggregations