StringBuilder sb = new StringBuilder(); sb.append("rpc_version: "); sb.append(inbound.getRpcVersion()); sb.append("\ncredentials:\n\t"); sb.append(inbound.getCredentials()); sb.append("properties:"); List<Property> props = inbound.getProperties().getPropertiesList(); for (Property p: props) { if (!p.getKey().equalsIgnoreCase("password")) { sb.append(inbound.getSupportComplexTypes()); sb.append("\nsupport_timeout: "); sb.append(inbound.getSupportTimeout()); sb.append("sasl_support: "); sb.append(inbound.getSaslSupport()); sb.append("\nclient_infos:\n\t"); sb.append(inbound.getClientInfos().toString().replace("\n", "\n\t")); return sb.toString();
if (!inbound.hasSupportTimeout() || !inbound.getSupportTimeout()) { connection.disableReadTimeout(); logger.warn("Timeout Disabled as client doesn't support it.", connection.getName()); if (inbound.getRpcVersion() != UserRpcConfig.RPC_VERSION) { final String errMsg = String.format("Invalid rpc version. Expected %d, actual %d.", UserRpcConfig.RPC_VERSION, inbound.getRpcVersion()); connection.finalizeSession(inbound.getCredentials().getUserName()); respBuilder.setStatus(HandshakeStatus.SUCCESS); return respBuilder.build(); final boolean clientSupportsSasl = inbound.hasSaslSupport(); final int saslSupportOrdinal = (clientSupportsSasl) ? inbound.getSaslSupport().ordinal() : SaslSupport.UNKNOWN_SASL_SUPPORT.ordinal(); final String userName = inbound.getCredentials().getUserName(); if (logger.isTraceEnabled()) { logger.trace("User {} on connection {} is likely using an older client.", final UserProperties props = inbound.getProperties(); for (int i = 0; i < props.getPropertiesCount(); i++) { Property prop = props.getProperties(i);
final UserCredentials credentials) throws RpcException { final UserToBitHandshake.Builder hsBuilder = UserToBitHandshake.newBuilder() .setRpcVersion(UserRpcConfig.RPC_VERSION) .setSupportListening(true)
public Builder mergeFrom(org.apache.drill.exec.proto.UserProtos.UserToBitHandshake other) { if (other == org.apache.drill.exec.proto.UserProtos.UserToBitHandshake.getDefaultInstance()) return this; if (other.hasChannel()) { setChannel(other.getChannel()); if (other.hasSupportListening()) { setSupportListening(other.getSupportListening()); if (other.hasRpcVersion()) { setRpcVersion(other.getRpcVersion()); if (other.hasCredentials()) { mergeCredentials(other.getCredentials()); if (other.hasProperties()) { mergeProperties(other.getProperties()); if (other.hasSupportComplexTypes()) { setSupportComplexTypes(other.getSupportComplexTypes()); if (other.hasSupportTimeout()) { setSupportTimeout(other.getSupportTimeout()); if (other.hasClientInfos()) { mergeClientInfos(other.getClientInfos()); if (other.hasSaslSupport()) { setSaslSupport(other.getSaslSupport()); this.mergeUnknownFields(other.getUnknownFields());
/** * Sets the user on the session, and finalizes the session. * * @param userName user name to set on the session * */ void finalizeSession(String userName) { // create a session session = UserSession.Builder.newBuilder() .withCredentials(UserCredentials.newBuilder() .setUserName(userName) .build()) .withOptionManager(userWorker.getSystemOptions()) .withUserProperties(inbound.getProperties()) .setSupportComplexTypes(inbound.getSupportComplexTypes()) .build(); // if inbound impersonation is enabled and a target is mentioned final String targetName = session.getTargetUserName(); if (config.getImpersonationManager() != null && targetName != null) { config.getImpersonationManager().replaceUserOnSession(targetName, session); } }
public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.UserProtos.UserToBitHandshake message) throws java.io.IOException { if(message.hasChannel()) output.writeEnum(1, message.getChannel().getNumber(), false); if(message.hasSupportListening()) output.writeBool(2, message.getSupportListening(), false); if(message.hasRpcVersion()) output.writeInt32(3, message.getRpcVersion(), false); if(message.hasCredentials()) output.writeObject(4, message.getCredentials(), org.apache.drill.exec.proto.SchemaUserBitShared.UserCredentials.WRITE, false); if(message.hasProperties()) output.writeObject(5, message.getProperties(), org.apache.drill.exec.proto.SchemaUserProtos.UserProperties.WRITE, false); if(message.hasSupportComplexTypes()) output.writeBool(6, message.getSupportComplexTypes(), false); if(message.hasSupportTimeout()) output.writeBool(7, message.getSupportTimeout(), false); if(message.hasClientInfos()) output.writeObject(8, message.getClientInfos(), org.apache.drill.exec.proto.SchemaUserProtos.RpcEndpointInfos.WRITE, false); if(message.hasSaslSupport()) output.writeEnum(9, message.getSaslSupport().getNumber(), false); } public boolean isInitialized(org.apache.drill.exec.proto.UserProtos.UserToBitHandshake message)
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.drill.exec.proto.UserProtos.UserToBitHandshake prototype) {
public Builder toBuilder() { return newBuilder(this); }
public static Builder newBuilder(org.apache.drill.exec.proto.UserProtos.UserToBitHandshake prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (hasProperties()) { if (!getProperties().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
public org.apache.drill.exec.proto.UserProtos.UserToBitHandshake.Builder newMessage() { return org.apache.drill.exec.proto.UserProtos.UserToBitHandshake.newBuilder(); } public java.lang.String getFieldName(int number)
public Builder mergeFrom(org.apache.drill.exec.proto.UserProtos.UserToBitHandshake other) { if (other == org.apache.drill.exec.proto.UserProtos.UserToBitHandshake.getDefaultInstance()) return this; if (other.hasChannel()) { setChannel(other.getChannel()); if (other.hasSupportListening()) { setSupportListening(other.getSupportListening()); if (other.hasRpcVersion()) { setRpcVersion(other.getRpcVersion()); if (other.hasCredentials()) { mergeCredentials(other.getCredentials()); if (other.hasProperties()) { mergeProperties(other.getProperties()); if (other.hasSupportComplexTypes()) { setSupportComplexTypes(other.getSupportComplexTypes()); if (other.hasSupportTimeout()) { setSupportTimeout(other.getSupportTimeout()); if (other.hasClientInfos()) { mergeClientInfos(other.getClientInfos()); if (other.hasSaslSupport()) { setSaslSupport(other.getSaslSupport()); this.mergeUnknownFields(other.getUnknownFields());
public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.UserProtos.UserToBitHandshake message) throws java.io.IOException { if(message.hasChannel()) output.writeEnum(1, message.getChannel().getNumber(), false); if(message.hasSupportListening()) output.writeBool(2, message.getSupportListening(), false); if(message.hasRpcVersion()) output.writeInt32(3, message.getRpcVersion(), false); if(message.hasCredentials()) output.writeObject(4, message.getCredentials(), org.apache.drill.exec.proto.SchemaUserBitShared.UserCredentials.WRITE, false); if(message.hasProperties()) output.writeObject(5, message.getProperties(), org.apache.drill.exec.proto.SchemaUserProtos.UserProperties.WRITE, false); if(message.hasSupportComplexTypes()) output.writeBool(6, message.getSupportComplexTypes(), false); if(message.hasSupportTimeout()) output.writeBool(7, message.getSupportTimeout(), false); if(message.hasClientInfos()) output.writeObject(8, message.getClientInfos(), org.apache.drill.exec.proto.SchemaUserProtos.RpcEndpointInfos.WRITE, false); if(message.hasSaslSupport()) output.writeEnum(9, message.getSaslSupport().getNumber(), false); } public boolean isInitialized(org.apache.drill.exec.proto.UserProtos.UserToBitHandshake message)
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.drill.exec.proto.UserProtos.UserToBitHandshake prototype) {
public Builder toBuilder() { return newBuilder(this); }
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (hasProperties()) { if (!getProperties().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
public static Builder newBuilder(org.apache.drill.exec.proto.UserProtos.UserToBitHandshake prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
public org.apache.drill.exec.proto.UserProtos.UserToBitHandshake.Builder newMessage() { return org.apache.drill.exec.proto.UserProtos.UserToBitHandshake.newBuilder(); } public java.lang.String getFieldName(int number)