@Override public ClientBuilder authentication(String authPluginClassName, String authParamsString) throws UnsupportedAuthenticationException { conf.setAuthentication(AuthenticationFactory.create(authPluginClassName, authParamsString)); return this; }
@Override public ClientBuilder authentication(String authPluginClassName, Map<String, String> authParams) throws UnsupportedAuthenticationException { conf.setAuthentication(AuthenticationFactory.create(authPluginClassName, authParams)); return this; }
/** * Construct a new Pulsar Admin client object. * <p> * This client object can be used to perform many subsquent API calls * * @param serviceUrl * the Pulsar URL (eg. "http://my-broker.example.com:8080") * @param authPluginClassName * name of the Authentication-Plugin you want to use * @param authParamsString * string which represents parameters for the Authentication-Plugin, e.g., "key1:val1,key2:val2" * @deprecated Since 2.0. Use {@link #builder()} to construct a new {@link PulsarAdmin} instance. */ @Deprecated public PulsarAdmin(URL serviceUrl, String authPluginClassName, String authParamsString) throws PulsarClientException { this(serviceUrl, AuthenticationFactory.create(authPluginClassName, authParamsString)); }
/** * Construct a new Pulsar Admin client object. * <p> * This client object can be used to perform many subsquent API calls * * @param serviceUrl * the Pulsar URL (eg. "http://my-broker.example.com:8080") * @param authPluginClassName * name of the Authentication-Plugin you want to use * @param authParams * map which represents parameters for the Authentication-Plugin * @deprecated Since 2.0. Use {@link #builder()} to construct a new {@link PulsarAdmin} instance. */ @Deprecated public PulsarAdmin(URL serviceUrl, String authPluginClassName, Map<String, String> authParams) throws PulsarClientException { this(serviceUrl, AuthenticationFactory.create(authPluginClassName, authParams)); }
@Override public PulsarAdminBuilder authentication(String authPluginClassName, String authParamsString) throws UnsupportedAuthenticationException { conf.setAuthentication(AuthenticationFactory.create(authPluginClassName, authParamsString)); return this; }
@Override public ClientBuilder authentication(String authPluginClassName, String authParamsString) throws UnsupportedAuthenticationException { conf.setAuthentication(AuthenticationFactory.create(authPluginClassName, authParamsString)); return this; }
@Override public PulsarAdminBuilder authentication(String authPluginClassName, Map<String, String> authParams) throws UnsupportedAuthenticationException { conf.setAuthentication(AuthenticationFactory.create(authPluginClassName, authParams)); return this; }
@Override public ClientBuilder authentication(String authPluginClassName, Map<String, String> authParams) throws UnsupportedAuthenticationException { conf.setAuthentication(AuthenticationFactory.create(authPluginClassName, authParams)); return this; }
/** * Set the authentication provider to use in the Pulsar client instance. * <p> * Example: * <p> * * <pre> * <code> * ClientConfiguration confData = new ClientConfiguration(); * String authPluginClassName = "org.apache.pulsar.client.impl.auth.MyAuthentication"; * String authParamsString = "key1:val1,key2:val2"; * confData.setAuthentication(authPluginClassName, authParamsString); * PulsarClient client = PulsarClient.create(serviceUrl, confData); * .... * </code> * </pre> * * @param authPluginClassName * name of the Authentication-Plugin you want to use * @param authParamsString * string which represents parameters for the Authentication-Plugin, e.g., "key1:val1,key2:val2" * @throws UnsupportedAuthenticationException * failed to instantiate specified Authentication-Plugin */ public void setAuthentication(String authPluginClassName, String authParamsString) throws UnsupportedAuthenticationException { confData.setAuthentication(AuthenticationFactory.create(authPluginClassName, authParamsString)); }
/** * Set the authentication provider to use in the Pulsar client instance. * <p> * Example: * <p> * * <pre> * <code> * ClientConfiguration confData = new ClientConfiguration(); * String authPluginClassName = "org.apache.pulsar.client.impl.auth.MyAuthentication"; * Map<String, String> authParams = new HashMap<String, String>(); * authParams.put("key1", "val1"); * confData.setAuthentication(authPluginClassName, authParams); * PulsarClient client = PulsarClient.create(serviceUrl, confData); * .... * </code> * </pre> * * @param authPluginClassName * name of the Authentication-Plugin you want to use * @param authParams * map which represents parameters for the Authentication-Plugin * @throws UnsupportedAuthenticationException * failed to instantiate specified Authentication-Plugin */ public void setAuthentication(String authPluginClassName, Map<String, String> authParams) throws UnsupportedAuthenticationException { confData.setAuthentication(AuthenticationFactory.create(authPluginClassName, authParams)); }
Authentication auth = AuthenticationFactory.create(authPluginClassName, authParams); auth.start(); AuthenticationDataProvider authData = auth.getAuthData();
@Override protected HttpClient newHttpClient() { try { Authentication auth = AuthenticationFactory.create( config.getBrokerClientAuthenticationPlugin(), config.getBrokerClientAuthenticationParameters()
ClientConfigurationData createClientConfiguration() throws UnsupportedAuthenticationException { ClientConfigurationData clientConf = new ClientConfigurationData(); clientConf.setServiceUrl(service.getServiceUrl()); ProxyConfiguration proxyConfig = service.getConfiguration(); if (proxyConfig.getBrokerClientAuthenticationPlugin() != null) { clientConf.setAuthentication(AuthenticationFactory.create(proxyConfig.getBrokerClientAuthenticationPlugin(), proxyConfig.getBrokerClientAuthenticationParameters())); } if (proxyConfig.isTlsEnabledWithBroker()) { clientConf.setUseTls(true); clientConf.setTlsTrustCertsFilePath(proxyConfig.getBrokerClientTrustCertsFilePath()); clientConf.setTlsAllowInsecureConnection(proxyConfig.isTlsAllowInsecureConnection()); } return clientConf; }