cluster = Cluster.builder().withCredentials(username, password) .withPort(Integer.valueOf(port)).addContactPoints(hosts).build(); } else {
clusterBuilder.withCredentials(config.getUsername(), config.getPassword());
builder.withCredentials(m_clusterConfiguration.getAuthUser(), m_clusterConfiguration.getAuthPassword());
@VisibleForTesting Cluster getCluster(DatabaseConfig config) { if (config.getUsername() != null && config.getPassword() != null) { builder.withCredentials(config.getUsername(), config.getPassword()); } return builder.build(); } }
private Cluster.Builder populateCredentials(Properties properties, Cluster.Builder builder) { String usernameProp = properties.getProperty(CassandraStoreParameters.USERNAME); String passwordProp = properties.getProperty(CassandraStoreParameters.PASSWORD); if (usernameProp != null) { builder = builder.withCredentials(usernameProp, passwordProp); } return builder; }
/** * @see Cluster.Builder#withCredentials(String, String) */ public ClusterBuilder withCredentials(String username, String password) { builder.withCredentials(username, password); return this; }
/** * @see Cluster.Builder#withCredentials(String, String) */ public ClusterBuilder withCredentialsObfuscated(String username, String obfuscatedPassword) { builder.withCredentials(username, PicketBoxObfuscator.decode(obfuscatedPassword)); return this; }
@Provides @Singleton Cluster provideCassandraCluster(ReconnectionPolicy reconnectionPolicy) { return Cluster.builder() .addContactPoint("cassandra-02.dev.redroma.tech") .withPort(9042) .withCredentials("cassandra", "cassandra") .withReconnectionPolicy(reconnectionPolicy) .build(); }
private Builder populateCredentials(Map<String, String> properties, Builder builder) { String usernameProp = properties.get(DBConstants.Cassandra.USERNAME); String passwordProp = properties.get(DBConstants.Cassandra.PASSWORD); if (usernameProp != null) { builder = builder.withCredentials(usernameProp, passwordProp); } return builder; }
public CassandraController(JSONConfig config) { Cluster.Builder builder = Cluster.builder().withClusterName("FlareBot Nodes") .withCredentials(config.getString("cassandra.username").get(), config.getString("cassandra.password").get()) .withPoolingOptions(new PoolingOptions().setConnectionsPerHost(HostDistance.LOCAL, 2, 4).setConnectionsPerHost(HostDistance.REMOTE, 2, 4)); config.getArray("cassandra.nodes").ifPresent(array -> array.forEach(ip -> builder.addContactPoint(ip.getAsString()))); cluster = builder.build(); session = cluster.connect(); }
.withRetryPolicy(DefaultRetryPolicy.INSTANCE); builder.withPort(getConfiguration().getPort()); builder.withCredentials( getConfiguration().getUsername(), getConfiguration().getPassword()
if (host.getUser() != null) connectionBuilder.withCredentials(host.getUser(), host.getPassword());
builder.withCredentials(username, password);
String password = config.get(CassandraOptions.CASSANDRA_PASSWORD); if (!username.isEmpty()) { builder.withCredentials(username, password);
.addContactPoints(getContactPoints()) .withPort(ccm().getBinaryPort()) .withCredentials("bogus", "bogus") .build());
datastaxCluster.withCredentials( cassandraConfig.getUsername(), cassandraConfig.getPassword()
builder = builder.withCredentials(user, pwd); builder = builder.withCredentials(creds.getUser(), creds.getPassword());
/** * Create new cassandra cluster using builder. */ @PostConstruct public void init() { Cluster.Builder builder = Cluster.builder() .addContactPointsWithPorts(parseNodeList(nodeList)) .withClusterName(clusterName) .withSocketOptions(clientOptions.getSocketOptions()); if (!useJmx) { builder.withoutJMXReporting(); } if (disableMetrics) { builder.withoutMetrics(); } if (useCredentials) { builder.withCredentials(username, password); } if (useSsl) { builder.withSSL(); } builder.withQueryOptions(clientOptions.getQueryOptions()); builder.withCompression(parseCompression(compression)); cluster = builder.build(); }
/** * Uses a Cluster.Builder to create a Cassandra cluster reference using the given parameters * * @param contactPoints The contact points (hostname:port list of Cassandra nodes) * @param sslContext The SSL context (used for secure connections) * @param username The username for connection authentication * @param password The password for connection authentication * @return A reference to the Cluster object associated with the given Cassandra configuration */ protected Cluster createCluster(List<InetSocketAddress> contactPoints, SSLContext sslContext, String username, String password) { Cluster.Builder builder = Cluster.builder().addContactPointsWithPorts(contactPoints); if (sslContext != null) { JdkSSLOptions sslOptions = JdkSSLOptions.builder() .withSSLContext(sslContext) .build(); builder = builder.withSSL(sslOptions); } if (username != null && password != null) { builder = builder.withCredentials(username, password); } return builder.build(); }
private Cluster createCluster(List<InetSocketAddress> contactPoints, SSLContext sslContext, String username, String password) { Cluster.Builder builder = Cluster.builder().addContactPointsWithPorts(contactPoints); if (sslContext != null) { JdkSSLOptions sslOptions = JdkSSLOptions.builder() .withSSLContext(sslContext) .build(); builder = builder.withSSL(sslOptions); } if (username != null && password != null) { builder = builder.withCredentials(username, password); } return builder.build(); } }