client.login(new AuthenticationRequest(credentials)); } catch (Exception e) { // TTransportException will propagate authentication/authorization failure throw new TTransportException(e);
private static void login(Client client, CassandraCredentialsConfig config) throws TException { Map<String, String> credsMap = Maps.newHashMap(); credsMap.put("username", config.username()); credsMap.put("password", config.password()); client.login(new AuthenticationRequest(credsMap)); }
credentials.put("password", password); AuthenticationRequest auth_request = new AuthenticationRequest(credentials); cassandra_client.login(auth_request);
credentials.put("password", m_dbpassword); AuthenticationRequest auth_request = new AuthenticationRequest(credentials); m_client.login(auth_request); } catch (Exception e) {
thriftCredentials.put("username", credentials.getUsername()); thriftCredentials.put("password", credentials.getPassword()); cassandraClient.login(new AuthenticationRequest(thriftCredentials));
client.login(new AuthenticationRequest(credentials)); } catch (Exception e) { // TTransportException will propagate authentication/authorization failure throw new TTransportException(e);
client.login(new AuthenticationRequest(credentials)); } catch (Exception e) { // TTransportException will propagate authentication/authorization failure throw new TTransportException(e);
public static Cassandra.Client createAuthenticatedClient(String location, int port, Configuration conf) throws Exception { logger.debug("Creating authenticated client for CF input format"); TTransport transport; try { transport = ConfigHelper.getClientTransportFactory(conf).openTransport(location, port); } catch (Exception e) { throw new TTransportException("Failed to open a transport to " + location + ":" + port + ".", e); } TProtocol binaryProtocol = new TBinaryProtocol(transport, true, true); Cassandra.Client client = new Cassandra.Client(binaryProtocol); // log in client.set_keyspace(ConfigHelper.getInputKeyspace(conf)); if ((ConfigHelper.getInputKeyspaceUserName(conf) != null) && (ConfigHelper.getInputKeyspacePassword(conf) != null)) { Map<String, String> creds = new HashMap<String, String>(); creds.put(IAuthenticator.USERNAME_KEY, ConfigHelper.getInputKeyspaceUserName(conf)); creds.put(IAuthenticator.PASSWORD_KEY, ConfigHelper.getInputKeyspacePassword(conf)); AuthenticationRequest authRequest = new AuthenticationRequest(creds); client.login(authRequest); } logger.debug("Authenticated client for CF input format created successfully"); return client; }
public static Cassandra.Client createAuthenticatedClient(String location, int port, Configuration conf) throws Exception { logger.debug("Creating authenticated client for CF input format"); TTransport transport; try { transport = ConfigHelper.getClientTransportFactory(conf).openTransport(location, port); } catch (Exception e) { throw new TTransportException("Failed to open a transport to " + location + ":" + port + ".", e); } TProtocol binaryProtocol = new TBinaryProtocol(transport, true, true); Cassandra.Client client = new Cassandra.Client(binaryProtocol); // log in client.set_keyspace(ConfigHelper.getInputKeyspace(conf)); if ((ConfigHelper.getInputKeyspaceUserName(conf) != null) && (ConfigHelper.getInputKeyspacePassword(conf) != null)) { Map<String, String> creds = new HashMap<String, String>(); creds.put(IAuthenticator.USERNAME_KEY, ConfigHelper.getInputKeyspaceUserName(conf)); creds.put(IAuthenticator.PASSWORD_KEY, ConfigHelper.getInputKeyspacePassword(conf)); AuthenticationRequest authRequest = new AuthenticationRequest(creds); client.login(authRequest); } logger.debug("Authenticated client for CF input format created successfully"); return client; }
try { Cassandra.Client client = ConfigHelper.getClientFromOutputAddressList(conf); + + if (ConfigHelper.getOutputKeyspaceUserName(conf) != null) + { + Map<String, String> credentials = new HashMap<String, String>(); + credentials.put(IAuthenticator.USERNAME_KEY, ConfigHelper.getOutputKeyspaceUserName(conf)); + credentials.put(IAuthenticator.PASSWORD_KEY, ConfigHelper.getOutputKeyspacePassword(conf)); + AuthenticationRequest authRequest = new AuthenticationRequest(credentials); + client.login(authRequest); + } + retrievePartitionKeyValidator(client); String cqlQuery = CqlConfigHelper.getOutputCql(conf).trim(); if (cqlQuery.toLowerCase().startsWith("insert"))
private static Cassandra.Client createThriftClient(String host, int port, String user, String passwd, ITransportFactory transportFactory) throws Exception { TTransport trans = transportFactory.openTransport(host, port); TProtocol protocol = new TBinaryProtocol(trans); Cassandra.Client client = new Cassandra.Client(protocol); if (user != null && passwd != null) { Map<String, String> credentials = new HashMap<>(); credentials.put(IAuthenticator.USERNAME_KEY, user); credentials.put(IAuthenticator.PASSWORD_KEY, passwd); AuthenticationRequest authenticationRequest = new AuthenticationRequest(credentials); client.login(authenticationRequest); } return client; } }
public static void login(String user, String password, Cassandra.Client client) throws Exception { Map<String, String> creds = new HashMap<String, String>(); creds.put(IAuthenticator.USERNAME_KEY, user); creds.put(IAuthenticator.PASSWORD_KEY, password); AuthenticationRequest authRequest = new AuthenticationRequest(creds); client.login(authRequest); }
public static void login(String user, String password, Cassandra.Client client) throws Exception { Map<String, String> creds = new HashMap<String, String>(); creds.put(IAuthenticator.USERNAME_KEY, user); creds.put(IAuthenticator.PASSWORD_KEY, password); AuthenticationRequest authRequest = new AuthenticationRequest(creds); client.login(authRequest); }
private static void login(Client client, CassandraCredentialsConfig config) throws TException { Map<String, String> credsMap = Maps.newHashMap(); credsMap.put("username", config.username()); credsMap.put("password", config.password()); client.login(new AuthenticationRequest(credsMap)); }
@Override public void login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException { client.login(auth_request); }
private static void initClient(String username, String password) throws InvalidRequestException, TException, AuthenticationException, AuthorizationException { TTransport tr = new TFramedTransport(new TSocket(nodeListenAddress, 9160)); tr.open(); client = new Cassandra.Client(new TBinaryProtocol(tr)); client.set_keyspace(keyspace); if(username != null && password != null) { client.login(new AuthenticationRequest(ImmutableMap.of("username", username, "password", password))); } }
@Override public void login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException { client.login(auth_request); }
client.getCassandra().login(new AuthenticationRequest(op.credentials)); client.setAuthenticated(op.credentials);
credentials.put(idAuth.USERNAME_KEY, userName); credentials.put(idAuth.PASSWORD_KEY, password); CassandraCli.client.login(new AuthenticationRequest(credentials));
@Override public void login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException { client.login(auth_request); }