APISonar


org.infinispan.client.rest.configuration.RestClientConfiguration.security

> org > infinispan > client > rest > configuration > RestClientConfiguration > security
org APIs infinispan APIs client APIs rest APIs configuration APIs RestClientConfiguration APIs security APIs

Example 1
public static NettyHttpClient forConfiguration(RestClientConfiguration configuration) {
      ServerConfiguration serverConfiguration = configuration.servers().iterator().next();
      String host = serverConfiguration.host();
      int port = serverConfiguration.port();
      boolean priorKnowledge = configuration.priorKnowledge();
      String protocol = configuration.protocol().equals(HTTP_11) ? HTTP_1_1 : HTTP_2;
      boolean security = configuration.security().ssl().enabled();
      try {
         SslContext sslContext = NettyTruststoreUtil.createSslContext(configuration);
         String sniName = configuration.security().ssl().sniHostName();
         return new NettyHttpClient(host, port, security, priorKnowledge, protocol, sslContext, sniName);
      } catch (Exception e) {
         throw new RuntimeException("Error creating client", e);
      }
   }
Example 2
public void testUrlWithoutCredentials() {
      RestConnector connector = new RestConnector();
      RestConnection connection = (RestConnection) connector.getConnection("http://localhost:11222", null);
      RestClientConfigurationBuilder builder = connection.getBuilder();
      RestClientConfiguration configuration = builder.build();
      assertEquals(11222, configuration.servers().get(0).port());
      assertEquals("localhost", configuration.servers().get(0).host());
      assertFalse(configuration.security().authentication().enabled());
   }