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("username", userName); credentials.put("password", password); AuthenticationRequest auth_request = new AuthenticationRequest(credentials); cassandra_client.login(auth_request);
public AuthenticationRequest deepCopy() { return new AuthenticationRequest(this); }
AuthenticationRequest req = new AuthenticationRequest() {{ setName("myName"); setPassword("myPass"); }}
public AuthenticationRequest deepCopy() { return new AuthenticationRequest(this); }
public AuthenticationRequest deepCopy() { return new AuthenticationRequest(this); }
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));
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 void fetchPermissions(final NeuraApiClient client) { client.getAppPermissions(new GetPermissionsRequestCallbacks() { @Override public void onSuccess(final List<Permission> permissions) throws RemoteException { runOnUiThread(new Runnable() { @Override public void run() { mPermissions = new ArrayList<>(permissions); mAuthenticateRequest = new AuthenticationRequest(); mAuthenticateRequest.setAppId(client.getAppUid()); mAuthenticateRequest.setAppSecret(client.getAppSecret()); mAuthenticateRequest.setPermissions(mPermissions); client.authenticate(100, mAuthenticateRequest); } }); } ... }); }
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; } }
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)); }
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))); } }
AuthenticationRequest req = new AuthenticationRequest(); req.setUserId("myName"); req.setPassword("myPass");
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; }
public CassandraManagedConnection(CassandraProperties properties) throws ResourceException { try { transport = new TFramedTransport(new TSocket( properties.getServer(), properties.getPort(), properties.getTimeout())); TProtocol framedProtocol = new TBinaryProtocol(transport); iface = new Cassandra.Client(framedProtocol); transport.open(); if (StringUtils.isNotBlank(properties.getUsername()) && StringUtils.isNotBlank(properties.getPassword())) { Map<String, String> credentials = new HashMap<String, String>(); //TODO AuthenticationRequest request = new AuthenticationRequest(credentials); request.validate(); iface.login(request); } if (StringUtils.isNotBlank(properties.getKeyspace())) { iface.set_keyspace(properties.getKeyspace()); } } catch (Exception ex) { throw new ResourceException(ex); } }
client.login(new AuthenticationRequest(credentials)); } catch (Exception e) { // TTransportException will propagate authentication/authorization failure throw new TTransportException(e);