Search in sources :

Example 1 with TruststoreSettings

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);
}
Also used : StringOption(util.StringOption) CertificateDataTable(models.datatable.CertificateDataTable) TruststoreSettings(com.emc.vipr.model.keystore.TruststoreSettings) FlashException(controllers.util.FlashException)

Example 2 with TruststoreSettings

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());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) TruststoreSettingsChanges(com.emc.vipr.model.keystore.TruststoreSettingsChanges) TruststoreSettings(com.emc.vipr.model.keystore.TruststoreSettings)

Example 3 with TruststoreSettings

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());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) TruststoreSettings(com.emc.vipr.model.keystore.TruststoreSettings)

Aggregations

TruststoreSettings (com.emc.vipr.model.keystore.TruststoreSettings)3 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 TruststoreSettingsChanges (com.emc.vipr.model.keystore.TruststoreSettingsChanges)1 FlashException (controllers.util.FlashException)1 CertificateDataTable (models.datatable.CertificateDataTable)1 StringOption (util.StringOption)1