Refine search
log.trace("Created transport {}", transport); TBinaryProtocol protocol = new TBinaryProtocol(transport); Cassandra.Client client = new Cassandra.Client(protocol); if (!transport.isOpen()) { transport.open(); client.login(new AuthenticationRequest(credentials)); } catch (Exception e) { // TTransportException will propagate authentication/authorization failure throw new TTransportException(e);
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof AuthenticationRequest) return this.equals((AuthenticationRequest)that); return false; }
public boolean equals(AuthenticationRequest that) { if (that == null) return false; boolean this_present_credentials = true && this.isSetCredentials(); boolean that_present_credentials = true && that.isSetCredentials(); if (this_present_credentials || that_present_credentials) { if (!(this_present_credentials && that_present_credentials)) return false; if (!this.credentials.equals(that.credentials)) return false; } return true; }
AuthenticationRequest req = new AuthenticationRequest(); req.setUserId("myName"); req.setPassword("myPass");
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); } }
this.connection = new Cassandra.Client(protocol); AuthenticationRequest authenticationRequest = new AuthenticationRequest(); authenticationRequest.putToCredentials("username", poolProperties.getUsername()); authenticationRequest.putToCredentials("password", poolProperties.getPassword()); try { this.connection.login(authenticationRequest); } catch (AuthenticationException e) { this.disconnect(false); this.connection.set_keyspace(poolProperties.getKeySpace()); } catch (InvalidRequestException e) { this.disconnect(false);
public Object getFieldValue(_Fields field) { switch (field) { case CREDENTIALS: return getCredentials(); } throw new IllegalStateException(); }
struct.setCredentialsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationRequest struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.credentials != null) { oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.credentials.size())); for (Map.Entry<String, String> _iter84 : struct.credentials.entrySet()) { oprot.writeString(_iter84.getKey()); oprot.writeString(_iter84.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public Object getFieldValue(_Fields field) { switch (field) { case CREDENTIALS: return getCredentials(); } throw new IllegalStateException(); }
struct.setCredentialsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationRequest struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.credentials != null) { oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.credentials.size())); for (Map.Entry<String, String> _iter84 : struct.credentials.entrySet()) { oprot.writeString(_iter84.getKey()); oprot.writeString(_iter84.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
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)); }
public Object getFieldValue(_Fields field) { switch (field) { case CREDENTIALS: return getCredentials(); } throw new IllegalStateException(); }
struct.setCredentialsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
public boolean equals(AuthenticationRequest that) { if (that == null) return false; boolean this_present_credentials = true && this.isSetCredentials(); boolean that_present_credentials = true && that.isSetCredentials(); if (this_present_credentials || that_present_credentials) { if (!(this_present_credentials && that_present_credentials)) return false; if (!this.credentials.equals(that.credentials)) return false; } return true; }
public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationRequest struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.credentials != null) { oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.credentials.size())); for (Map.Entry<String, String> _iter84 : struct.credentials.entrySet()) { oprot.writeString(_iter84.getKey()); oprot.writeString(_iter84.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof AuthenticationRequest) return this.equals((AuthenticationRequest)that); return false; }
TTransport transport = new TFramedTransport(socket); TProtocol protocol = new TBinaryProtocol(transport, true, true); cassandra_client = new Cassandra.Client(protocol); try credentials.put("username", userName); credentials.put("password", password); AuthenticationRequest auth_request = new AuthenticationRequest(credentials); cassandra_client.login(auth_request);
public void login(AuthenticationRequest auth_request) throws TException { try { state().login(DatabaseDescriptor.getAuthenticator().legacyAuthenticate(auth_request.getCredentials())); } catch (org.apache.cassandra.exceptions.AuthenticationException e) { throw ThriftConversion.toThrift(e); } }