APISonar


org.infinispan.client.hotrod.configuration.ConfigurationBuilder.security

> org > infinispan > client > hotrod > configuration > ConfigurationBuilder > security
org APIs infinispan APIs client APIs hotrod APIs configuration APIs ConfigurationBuilder APIs security APIs

Example 1
private static ConfigurationBuilder withSsl(ConfigurationBuilder cb, String trustorePath, char[] password) {
        cb.security()
                .ssl()
                .enabled(true)
                .trustStoreFileName(trustorePath)
                .trustStorePassword(password);
        return cb;
    }
Example 2
protected Configuration getRemoteCacheManagerConfig(String login, String password) {
      ConfigurationBuilder config = getDefaultConfigBuilder();
      config.security().authentication().callbackHandler(new LoginHandler(login, password, TEST_REALM));
      return config.build();
   }
Example 3
public void testAuthenticationFailNoAuth() {
      ConfigurationBuilder clientBuilder = initServerAndClient(Collections.singletonMap(Sasl.POLICY_NOANONYMOUS, "true"));
      clientBuilder.security().authentication().disable();
      remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
      RemoteCache<String, String> cache = remoteCacheManager.getCache();
      cache.put("a", "a");
   }
Example 4
protected Configuration getRemoteCacheManagerConfig(Subject subj) {
      ConfigurationBuilder config = getDefaultConfigBuilder();
      config.security().authentication().clientSubject(subj).callbackHandler(new LoginHandler("", "")); //callback handle is required by ISPN config validation
      return config.build();
   }
Example 5
public void testViaDirectConfig() throws Exception {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      String hostname = ispnServer.getHotrodEndpoint().getInetAddress().getHostName();
      builder.addServer().host(hostname).port(ispnServer.getHotrodEndpoint().getPort());
      builder.security().ssl().enable().trustStoreFileName(DEFAULT_TRUSTSTORE_PATH).trustStorePassword(DEFAULT_TRUSTSTORE_PASSWORD.toCharArray());
      remoteCacheManager = new RemoteCacheManager(builder.build());
      remoteCache = remoteCacheManager.getCache(RemoteCacheManager.DEFAULT_CACHE_NAME);
      testPutGet(remoteCache);
      testSize(remoteCache);
   }
Example 6
public void testTrustedCertificate() {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      SERVERS.getServerDriver().applyTrustStore(builder, "ca");
      SERVERS.getServerDriver().applyKeyStore(builder, "admin");
      builder.security()
            .authentication()
            .saslMechanism("EXTERNAL")
            .serverName("infinispan")
            .realm("default");

      RemoteCache<String, String> cache = SERVER_TEST.hotrod().withClientConfiguration(builder).withCacheMode(CacheMode.DIST_SYNC).create();
      cache.put("k1", "v1");
      assertEquals(1, cache.size());
      assertEquals("v1", cache.get("k1"));
   }
Example 7
private ConfigurationBuilder securityConfig(final String keystoreName, final String truststoreName,
                                                RemoteInfinispanServer server) {
        ConfigurationBuilder builder = ITestUtils.createConfigBuilder(server.getHotrodEndpoint().getInetAddress().getHostName(),
                server.getHotrodEndpoint().getPort());
        builder.security().ssl().enable().keyStoreFileName(ITestUtils.SERVER_CONFIG_DIR + File.separator + keystoreName)
                .keyStorePassword("secret".toCharArray())
                .trustStoreFileName(ITestUtils.SERVER_CONFIG_DIR + File.separator + truststoreName)
                .trustStorePassword("secret".toCharArray());
        return builder;
    }
Example 8
private void addBuilder(String username, String password) {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      builder.security().authentication()
            .saslMechanism("GSSAPI")
            .serverName("datagrid")
            .callbackHandler(new VoidCallbackHandler())
            .clientSubject(Common.createSubject(username, "INFINISPAN.ORG", password.toCharArray()));
      builderMap.put(username, builder);
   }
Example 9
protected RemoteCacheManager createRemoteCacheManager(int port) {
      ConfigurationBuilder clientBuilder = HotRodClientTestingUtil.newRemoteConfigurationBuilder();
      clientBuilder
         .security().authentication()
            .enable()
            .saslMechanism("CRAM-MD5")
            .callbackHandler(new TestCallbackHandler("user", "realm", "password".toCharArray()))
         .forceReturnValues(true)
         .connectionTimeout(5)
         .connectionPool().maxActive(1)
         .addServer().host("127.0.0.1").port(port);
      return new InternalRemoteCacheManager(clientBuilder.build());
   }
Example 10
public void testAuthenticationFailWrongAuth() {
      ConfigurationBuilder clientBuilder = initServerAndClient();
      clientBuilder.security().authentication().callbackHandler(new TestCallbackHandler("user", "realm", "foobar".toCharArray()));
      remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
      remoteCacheManager.getCache();
   }
Example 11
protected ConfigurationBuilder getDefaultConfigBuilder() {
      ConfigurationBuilder config = new ConfigurationBuilder();
      config.addServer().host(getHRServerHostname()).port(getHRServerPort());
      config.security().authentication().serverName(TEST_SERVER_NAME).saslMechanism(getTestedMech()).enable();
      return config;
   }