try { String authMethod = "none"; if (connect.hasAuthMethodName()) { authMethod = connect.getAuthMethodName(); } else if (connect.hasAuthMethod()) { authMethod = connect.getAuthMethod().name().substring(10).toLowerCase(); String authData = connect.getAuthData().toStringUtf8(); ChannelHandler sslHandler = ctx.channel().pipeline().get(TLS_HANDLER); SSLSession sslSession = null; ctx.writeAndFlush(Commands.newConnected(connect.getProtocolVersion())); state = State.Connected; remoteEndpointProtocolVersion = connect.getProtocolVersion();
try { String authMethod = "none"; if (connect.hasAuthMethodName()) { authMethod = connect.getAuthMethodName(); } else if (connect.hasAuthMethod()) { authMethod = connect.getAuthMethod().name().substring(10).toLowerCase(); String authData = connect.getAuthData().toStringUtf8(); ChannelHandler sslHandler = ctx.channel().pipeline().get(PulsarChannelInitializer.TLS_HANDLER); SSLSession sslSession = null; connect.hasOriginalAuthData() ? connect.getOriginalAuthData() : null, connect.hasOriginalAuthMethod() ? connect.getOriginalAuthMethod() : null, connect.hasOriginalPrincipal() ? connect.getOriginalPrincipal() : null, sslSession); authenticationData = new AuthenticationDataCommand(authData, remoteAddress, sslSession); log.debug("Received CONNECT from {}", remoteAddress); ctx.writeAndFlush(Commands.newConnected(connect.getProtocolVersion())); state = State.Connected; remoteEndpointProtocolVersion = connect.getProtocolVersion(); String version = connect.hasClientVersion() ? connect.getClientVersion() : null; if (isNotBlank(version) && !version.contains(" ") /* ignore default version: pulsar client */) { this.clientVersion = version.intern();
protected void handleConnect(CommandConnect connect) { checkArgument(state == State.Init); remoteEndpointProtocolVersion = connect.getProtocolVersion(); if (LOG.isDebugEnabled()) { LOG.debug("Received CONNECT from {} proxyToBroker={}", remoteAddress, connect.hasProxyToBrokerUrl() ? connect.getProxyToBrokerUrl() : "null"); if (connect.hasProxyToBrokerUrl()) { directProxyHandler = new DirectProxyHandler(service, this, connect.getProxyToBrokerUrl(), protocolVersionToAdvertise); cancelKeepAliveTask();
if (connect.hasAuthMethodName()) { authMethod = connect.getAuthMethodName(); } else if (connect.hasAuthMethod()) { authMethod = connect.getAuthMethod().name().substring(10).toLowerCase(); String authData = connect.getAuthData().toStringUtf8(); ChannelHandler sslHandler = ctx.channel().pipeline().get("tls"); SSLSession sslSession = null;
public Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.CommandConnect other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.CommandConnect.getDefaultInstance()) return this; if (other.hasClientVersion()) { setClientVersion(other.getClientVersion()); if (other.hasAuthMethod()) { setAuthMethod(other.getAuthMethod()); if (other.hasAuthMethodName()) { setAuthMethodName(other.getAuthMethodName()); if (other.hasAuthData()) { setAuthData(other.getAuthData()); if (other.hasProtocolVersion()) { setProtocolVersion(other.getProtocolVersion()); if (other.hasProxyToBrokerUrl()) { setProxyToBrokerUrl(other.getProxyToBrokerUrl()); if (other.hasOriginalPrincipal()) { setOriginalPrincipal(other.getOriginalPrincipal()); if (other.hasOriginalAuthData()) { setOriginalAuthData(other.getOriginalAuthData()); if (other.hasOriginalAuthMethod()) { setOriginalAuthMethod(other.getOriginalAuthMethod());
private static int getProtocolVersionToAdvertise(CommandConnect connect) { return Math.min(connect.getProtocolVersion(), Commands.getCurrentProtocolVersion()); }
public Builder clearAuthMethodName() { bitField0_ = (bitField0_ & ~0x00000004); authMethodName_ = getDefaultInstance().getAuthMethodName(); return this; } void setAuthMethodName(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder clearOriginalAuthData() { bitField0_ = (bitField0_ & ~0x00000080); originalAuthData_ = getDefaultInstance().getOriginalAuthData(); return this; } void setOriginalAuthData(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder clearAuthData() { bitField0_ = (bitField0_ & ~0x00000008); authData_ = getDefaultInstance().getAuthData(); return this; }
public Builder clearOriginalPrincipal() { bitField0_ = (bitField0_ & ~0x00000040); originalPrincipal_ = getDefaultInstance().getOriginalPrincipal(); return this; } void setOriginalPrincipal(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder clearClientVersion() { bitField0_ = (bitField0_ & ~0x00000001); clientVersion_ = getDefaultInstance().getClientVersion(); return this; } void setClientVersion(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder clearOriginalAuthMethod() { bitField0_ = (bitField0_ & ~0x00000100); originalAuthMethod_ = getDefaultInstance().getOriginalAuthMethod(); return this; } void setOriginalAuthMethod(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.CommandConnect other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.CommandConnect.getDefaultInstance()) return this; if (other.hasClientVersion()) { setClientVersion(other.getClientVersion()); if (other.hasAuthMethod()) { setAuthMethod(other.getAuthMethod()); if (other.hasAuthMethodName()) { setAuthMethodName(other.getAuthMethodName()); if (other.hasAuthData()) { setAuthData(other.getAuthData()); if (other.hasProtocolVersion()) { setProtocolVersion(other.getProtocolVersion()); if (other.hasProxyToBrokerUrl()) { setProxyToBrokerUrl(other.getProxyToBrokerUrl()); if (other.hasOriginalPrincipal()) { setOriginalPrincipal(other.getOriginalPrincipal()); if (other.hasOriginalAuthData()) { setOriginalAuthData(other.getOriginalAuthData()); if (other.hasOriginalAuthMethod()) { setOriginalAuthMethod(other.getOriginalAuthMethod());
public Builder clearAuthMethodName() { bitField0_ = (bitField0_ & ~0x00000004); authMethodName_ = getDefaultInstance().getAuthMethodName(); return this; } void setAuthMethodName(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder clearOriginalAuthData() { bitField0_ = (bitField0_ & ~0x00000080); originalAuthData_ = getDefaultInstance().getOriginalAuthData(); return this; } void setOriginalAuthData(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder clearOriginalPrincipal() { bitField0_ = (bitField0_ & ~0x00000040); originalPrincipal_ = getDefaultInstance().getOriginalPrincipal(); return this; } void setOriginalPrincipal(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder clearAuthData() { bitField0_ = (bitField0_ & ~0x00000008); authData_ = getDefaultInstance().getAuthData(); return this; }
public Builder clearOriginalAuthMethod() { bitField0_ = (bitField0_ & ~0x00000100); originalAuthMethod_ = getDefaultInstance().getOriginalAuthMethod(); return this; } void setOriginalAuthMethod(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {
public Builder clearClientVersion() { bitField0_ = (bitField0_ & ~0x00000001); clientVersion_ = getDefaultInstance().getClientVersion(); return this; } void setClientVersion(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {