use of org.wildfly.security.auth.client.InvalidAuthenticationConfigurationException in project wildfly by wildfly.
the class UndertowTwoWaySslNeedClientAuthTestCase method testResteasyElytronClientTrustedServer.
/**
* RESTEasy client loads truststore from Elytron client configuration. This truststore contains correct server certificate.
*/
@Test
public void testResteasyElytronClientTrustedServer() {
AuthenticationContext context = doPrivileged((PrivilegedAction<AuthenticationContext>) () -> {
try {
URL config = getClass().getResource("wildfly-config-correct-truststore.xml");
return ElytronXmlParser.parseAuthenticationClientConfiguration(config.toURI()).create();
} catch (Throwable t) {
throw new InvalidAuthenticationConfigurationException(t);
}
});
context.run(() -> {
ClientBuilder resteasyClientBuilder = ClientBuilder.newBuilder().hostnameVerifier((s, sslSession) -> true);
Client client = resteasyClientBuilder.build();
Response response = client.target(String.valueOf(securedRootUrl)).request().get();
Assert.assertEquals(200, response.getStatus());
});
}
Aggregations