Tabnine Logo
AuthenticationDataProvider
Code IndexAdd Tabnine to your IDE (free)

How to use
AuthenticationDataProvider
in
org.apache.pulsar.client.api

Best Java code snippets using org.apache.pulsar.client.api.AuthenticationDataProvider (Showing top 15 results out of 315)

origin: apache/pulsar

if (authData.hasDataForHttp()) {
  for (Map.Entry<String, String> header : authData.getHttpHeaders()) {
    builder.setHeader(header.getKey(), header.getValue());
origin: apache/pulsar

  public void initChannel(SocketChannel ch) throws Exception {
    if (conf.isUseTls()) {
      SslContext sslCtx;
      // Set client certificate if available
      AuthenticationDataProvider authData = conf.getAuthentication().getAuthData();
      if (authData.hasDataForTls()) {
        sslCtx = SecurityUtility.createNettySslContextForClient(conf.isTlsAllowInsecureConnection(),
            conf.getTlsTrustCertsFilePath(), (X509Certificate[]) authData.getTlsCertificates(),
            authData.getTlsPrivateKey());
      } else {
        sslCtx = SecurityUtility.createNettySslContextForClient(conf.isTlsAllowInsecureConnection(),
            conf.getTlsTrustCertsFilePath());
      }
      ch.pipeline().addLast(TLS_HANDLER, sslCtx.newHandler(ch.alloc()));
      ch.pipeline().addLast("ByteBufPairEncoder", ByteBufPair.COPYING_ENCODER);
    } else {
      ch.pipeline().addLast("ByteBufPairEncoder", ByteBufPair.ENCODER);
    }
    ch.pipeline().addLast("frameDecoder", new LengthFieldBasedFrameDecoder(MaxMessageSize, 0, 4, 0, 4));
    ch.pipeline().addLast("handler", clientCnxSupplier.get());
  }
});
origin: apache/pulsar

protected ByteBuf newConnectCommand() throws PulsarClientException {
  String authData = "";
  if (authentication.getAuthData().hasDataFromCommand()) {
    authData = authentication.getAuthData().getCommandData();
  }
  return Commands.newConnect(authentication.getAuthMethodName(), authData, this.protocolVersion,
      getPulsarClientVersion(), proxyToTargetBrokerAddress, null, null, null);
}
origin: apache/pulsar

if (authData.hasDataForTls()) {
  sslCtx = SecurityUtility.createNettySslContextForClient(tlsAllowInsecureConnection, tlsTrustCertsFilePath,
      authData.getTlsCertificates(), authData.getTlsPrivateKey());
} else {
  sslCtx = SecurityUtility.createNettySslContextForClient(tlsAllowInsecureConnection, tlsTrustCertsFilePath);
origin: org.apache.pulsar/pulsar-client-admin-original

public Builder request(final WebTarget target) throws PulsarAdminException {
  try {
    Builder builder = target.request(MediaType.APPLICATION_JSON);
    // Add headers for authentication if any
    if (auth != null && auth.getAuthData().hasDataForHttp()) {
      for (Map.Entry<String, String> header : auth.getAuthData().getHttpHeaders()) {
        builder.header(header.getKey(), header.getValue());
      }
    }
    return builder;
  } catch (Throwable t) {
    throw new GettingAuthenticationDataException(t);
  }
}
origin: org.apache.pulsar/pulsar-proxy

@Override
protected ByteBuf newConnectCommand() throws PulsarClientException {
  if (log.isDebugEnabled()) {
    log.debug(
        "New Connection opened via ProxyClientCnx with params clientAuthRole = {}, clientAuthData = {}, clientAuthMethod = {}",
        clientAuthRole, clientAuthData, clientAuthMethod);
  }
  String authData = null;
  if (authentication.getAuthData().hasDataFromCommand()) {
    authData = authentication.getAuthData().getCommandData();
  }
  return Commands.newConnect(authentication.getAuthMethodName(), authData, protocolVersion,
      getPulsarClientVersion(), proxyToTargetBrokerAddress, clientAuthRole, clientAuthData, clientAuthMethod);
}
origin: org.apache.pulsar/pulsar-client-original

  public void initChannel(SocketChannel ch) throws Exception {
    if (conf.isUseTls()) {
      SslContext sslCtx;
      // Set client certificate if available
      AuthenticationDataProvider authData = conf.getAuthentication().getAuthData();
      if (authData.hasDataForTls()) {
        sslCtx = SecurityUtility.createNettySslContextForClient(conf.isTlsAllowInsecureConnection(),
            conf.getTlsTrustCertsFilePath(), (X509Certificate[]) authData.getTlsCertificates(),
            authData.getTlsPrivateKey());
      } else {
        sslCtx = SecurityUtility.createNettySslContextForClient(conf.isTlsAllowInsecureConnection(),
            conf.getTlsTrustCertsFilePath());
      }
      ch.pipeline().addLast(TLS_HANDLER, sslCtx.newHandler(ch.alloc()));
      ch.pipeline().addLast("ByteBufPairEncoder", ByteBufPair.COPYING_ENCODER);
    } else {
      ch.pipeline().addLast("ByteBufPairEncoder", ByteBufPair.ENCODER);
    }
    ch.pipeline().addLast("frameDecoder", new LengthFieldBasedFrameDecoder(MaxMessageSize, 0, 4, 0, 4));
    ch.pipeline().addLast("handler", clientCnxSupplier.get());
  }
});
origin: org.apache.pulsar/pulsar-client-original

if (authData.hasDataForHttp()) {
  for (Map.Entry<String, String> header : authData.getHttpHeaders()) {
    builder.setHeader(header.getKey(), header.getValue());
origin: org.apache.pulsar/pulsar-proxy

@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
  this.ctx = ctx;
  // Send the Connect command to broker
  String authData = "";
  if (authentication.getAuthData().hasDataFromCommand()) {
    authData = authentication.getAuthData().getCommandData();
  }
  ByteBuf command = null;
  command = Commands.newConnect(authentication.getAuthMethodName(), authData, protocolVersion, "Pulsar proxy",
      null /* target broker */, originalPrincipal, clientAuthData, clientAuthMethod);
  outboundChannel.writeAndFlush(command);
  outboundChannel.read();
}
origin: org.apache.pulsar/pulsar-proxy

  @Override
  protected void initChannel(SocketChannel ch) throws Exception {
    if (config.isTlsEnabledWithBroker()) {
      SslContext sslCtx;
      // Set client certificate if available
      AuthenticationDataProvider authData = authentication.getAuthData();
      if (authData.hasDataForTls()) {
        sslCtx = SecurityUtility.createNettySslContextForClient(config.isTlsAllowInsecureConnection(),
            config.getBrokerClientTrustCertsFilePath(),
            (X509Certificate[]) authData.getTlsCertificates(), authData.getTlsPrivateKey());
      } else {
        sslCtx = SecurityUtility.createNettySslContextForClient(config.isTlsAllowInsecureConnection(),
            config.getBrokerClientTrustCertsFilePath());
      }
      ch.pipeline().addLast(TLS_HANDLER, sslCtx.newHandler(ch.alloc()));
    }
    ch.pipeline().addLast("frameDecoder",
        new LengthFieldBasedFrameDecoder(PulsarDecoder.MaxFrameSize, 0, 4, 0, 4));
    ch.pipeline().addLast("proxyOutboundHandler", new ProxyBackendHandler(config, protocolVersion));
  }
});
origin: org.apache.pulsar/pulsar-testclient

auth.start();
AuthenticationDataProvider authData = auth.getAuthData();
if (authData.hasDataForHttp()) {
  for (Map.Entry<String, String> kv : authData.getHttpHeaders()) {
    produceRequest.setHeader(kv.getKey(), kv.getValue());
origin: org.apache.pulsar/pulsar-client-original

protected ByteBuf newConnectCommand() throws PulsarClientException {
  String authData = "";
  if (authentication.getAuthData().hasDataFromCommand()) {
    authData = authentication.getAuthData().getCommandData();
  }
  return Commands.newConnect(authentication.getAuthMethodName(), authData, this.protocolVersion,
      getPulsarClientVersion(), proxyToTargetBrokerAddress, null, null, null);
}
origin: org.apache.pulsar/pulsar-proxy

if (authData.hasDataForTls()) {
  sslCtx = SecurityUtility.createSslContext(
    config.isTlsAllowInsecureConnection(),
    trustCertificates,
    authData.getTlsCertificates(),
    authData.getTlsPrivateKey()
  );
} else {
origin: org.apache.pulsar/pulsar-client-original

if (authData.hasDataForTls()) {
  sslCtx = SecurityUtility.createNettySslContextForClient(tlsAllowInsecureConnection, tlsTrustCertsFilePath,
      authData.getTlsCertificates(), authData.getTlsPrivateKey());
} else {
  sslCtx = SecurityUtility.createNettySslContextForClient(tlsAllowInsecureConnection, tlsTrustCertsFilePath);
origin: org.apache.pulsar/pulsar-client-admin-original

if (authData.hasDataForTls()) {
  sslCtx = SecurityUtility.createSslContext(clientConfigData.isTlsAllowInsecureConnection(),
      trustCertificates, authData.getTlsCertificates(), authData.getTlsPrivateKey());
} else {
  sslCtx = SecurityUtility.createSslContext(clientConfigData.isTlsAllowInsecureConnection(),
org.apache.pulsar.client.apiAuthenticationDataProvider

Javadoc

Interface for accessing data which are used in variety of authentication schemes on client side

Most used methods

  • getHttpHeaders
  • getTlsCertificates
  • getTlsPrivateKey
  • hasDataForHttp
    Check if data for HTTP are available.
  • hasDataForTls
    Check if data for TLS are available.
  • getCommandData
  • hasDataFromCommand
    Check if data from Pulsar protocol are available.

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • getContentResolver (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now