use of com.emc.vipr.model.keystore.TruststoreSettings in project coprhd-controller by CoprHD.
the class Certificates method list.
@FlashException
public static void list() {
CertificateDataTable dataTable = new CertificateDataTable();
List<StringOption> options = Lists.newArrayList();
options.add(new StringOption("true", MessagesUtils.get("common.yes")));
options.add(new StringOption("false", MessagesUtils.get("common.no")));
TruststoreSettings certificateSettings = null;
certificateSettings = api().getTruststoreSettings();
angularRenderArgs().putAll(ImmutableMap.of("options", options, "certificateSettings", certificateSettings));
render(dataTable);
}
use of com.emc.vipr.model.keystore.TruststoreSettings in project coprhd-controller by CoprHD.
the class TrustStoreTest method changeTruststoreSettingsTest.
/**
*/
public void changeTruststoreSettingsTest(boolean acceptAllCerts) {
ClientResponse response;
TruststoreSettings settings;
// change the settings to the value of acceptAllCerts
TruststoreSettingsChanges settingsChanges = new TruststoreSettingsChanges();
settingsChanges.setAcceptAllCertificates(acceptAllCerts);
// test PUT with a non-privileged user -should fail
response = rRootUser2.path("/vdc/truststore/settings").put(ClientResponse.class, settingsChanges);
Assert.assertEquals(403, response.getStatus());
// test PUT with a security admin user -should succeed
response = rSys.path("/vdc/truststore/settings").put(ClientResponse.class, settingsChanges);
Assert.assertEquals(200, response.getStatus());
settings = response.getEntity(TruststoreSettings.class);
Assert.assertNotNull(settings);
Assert.assertEquals(acceptAllCerts, settings.isAcceptAllCertificates());
// a change in the truststore setting causes a reboot.
waitForClusterToBeStable();
// do another get to make sure the result is same as acceptAllCerts
response = rSys.path("/vdc/truststore/settings").get(ClientResponse.class);
Assert.assertEquals(200, response.getStatus());
settings = response.getEntity(TruststoreSettings.class);
Assert.assertNotNull(settings);
Assert.assertEquals(acceptAllCerts, settings.isAcceptAllCertificates());
}
use of com.emc.vipr.model.keystore.TruststoreSettings in project coprhd-controller by CoprHD.
the class TrustStoreTest method testDefaultSettings.
/**
*/
public void testDefaultSettings() {
// test GET with a non-privileged user -should fail
ClientResponse response = rRootUser2.path("/vdc/truststore/settings").get(ClientResponse.class);
Assert.assertEquals(403, response.getStatus());
// test GET with a security admin user -should succeed
// and acceptAllCertificates should be true
response = rSys.path("/vdc/truststore/settings").get(ClientResponse.class);
Assert.assertEquals(200, response.getStatus());
TruststoreSettings settings = response.getEntity(TruststoreSettings.class);
Assert.assertNotNull(settings);
Assert.assertTrue(settings.isAcceptAllCertificates());
}
Aggregations