Search in sources :

Example 1 with SecurityRealm

use of org.wildfly.swarm.config.management.SecurityRealm in project wildfly-swarm by wildfly-swarm.

the class HTTPSCustomizerTest method testWithManagementFraction.

@Test
public void testWithManagementFraction() throws Exception {
    HTTPSCustomizer customizer = new HTTPSCustomizer();
    customizer.undertow = new UndertowFraction();
    customizer.undertow.applyDefaults();
    customizer.certInfo = new CertInfo("myhost.com", "./my/path");
    customizer.managementCoreService = new MockInstance<>(new ManagementCoreService());
    customizer.customize();
    Server server = customizer.undertow.subresources().server("default-server");
    assertThat(server).isNotNull();
    assertThat(server.subresources().httpListeners()).hasSize(1);
    assertThat(server.subresources().httpListener("default")).isNotNull();
    assertThat(server.subresources().httpsListeners()).hasSize(1);
    assertThat(server.subresources().httpsListener("default-https")).isNotNull();
    SecurityRealm realm = customizer.managementCoreService.get().subresources().securityRealm("SSLRealm");
    assertThat(realm).isNotNull();
    assertThat(realm.subresources().sslServerIdentity().keystoreRelativeTo()).isEqualTo("./my/path");
    assertSelfSignedCertificate(realm.subresources().sslServerIdentity(), "myhost.com");
}
Also used : CertInfo(org.wildfly.swarm.undertow.descriptors.CertInfo) UndertowFraction(org.wildfly.swarm.undertow.UndertowFraction) Server(org.wildfly.swarm.config.undertow.Server) SecurityRealm(org.wildfly.swarm.config.management.SecurityRealm) ManagementCoreService(org.wildfly.swarm.config.ManagementCoreService) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ManagementCoreService (org.wildfly.swarm.config.ManagementCoreService)1 SecurityRealm (org.wildfly.swarm.config.management.SecurityRealm)1 Server (org.wildfly.swarm.config.undertow.Server)1 UndertowFraction (org.wildfly.swarm.undertow.UndertowFraction)1 CertInfo (org.wildfly.swarm.undertow.descriptors.CertInfo)1