diff --git a/site2/website/versioned_docs/version-2.10.x/client-libraries-java.md b/site2/website/versioned_docs/version-2.10.x/client-libraries-java.md index 030d9f6f9d5fe..0b402f1cc456d 100644 --- a/site2/website/versioned_docs/version-2.10.x/client-libraries-java.md +++ b/site2/website/versioned_docs/version-2.10.x/client-libraries-java.md @@ -168,7 +168,7 @@ You can set the client memory allocator configurations through Java properties.< |---|---|---|---|--- `pulsar.allocator.pooled` | String | If set to `true`, the client uses a direct memory pool.
If set to `false`, the client uses a heap memory without pool | true |
  • true
  • false
  • `pulsar.allocator.exit_on_oom` | String | Whether to exit the JVM when OOM happens | false |
  • true
  • false
  • -`pulsar.allocator.leak_detection` | String | Service URL provider for Pulsar service | Disabled |
  • Disabled
  • Simple
  • Advanced
  • Paranoid
  • +`pulsar.allocator.leak_detection` | String | The leak detection policy for Pulsar bytebuf allocator.
  • **Disabled**: No leak detection and no overhead.
  • **Simple**: Instruments 1% of the allocated buffer to track for leaks.
  • **Advanced**: Instruments 1% of the allocated buffer to track for leaks, reporting stack traces of places where the buffer is used.
  • **Paranoid**: Instruments 100% of the allocated buffer to track for leaks, reporting stack traces of places where the buffer is used and introduces a significant overhead.
  • | Disabled |
  • Disabled
  • Simple
  • Advanced
  • Paranoid
  • `pulsar.allocator.out_of_memory_policy` | String | When an OOM occurs, the client throws an exception or fallbacks to heap | FallbackToHeap |
  • ThrowException
  • FallbackToHeap
  • **Example**: diff --git a/site2/website/versioned_docs/version-2.10.x/io-debezium-source.md b/site2/website/versioned_docs/version-2.10.x/io-debezium-source.md index 122c4024068ad..aedbd18dce421 100644 --- a/site2/website/versioned_docs/version-2.10.x/io-debezium-source.md +++ b/site2/website/versioned_docs/version-2.10.x/io-debezium-source.md @@ -29,6 +29,8 @@ The configuration of Debezium source connector has the following properties. | `database.history.pulsar.service.url` | true | null | Pulsar cluster service URL for history topic. | | `offset.storage.topic` | true | null | Record the last committed offsets that the connector successfully completes. | | `json-with-envelope` | false | false | Present the message only consist of payload. +| `database.history.pulsar.reader.config` | false | null | The configs of the reader for the database schema history topic, in the form of a JSON string with key-value pairs.
    **Note:** This property is only available in 2.10.2 and later versions. | +| `offset.storage.reader.config` | false | null | The configs of the reader for the kafka connector offsets topic, in the form of a JSON string with key-value pairs.
    **Note:** This property is only available in 2.10.2 and later versions.| ### Converter Options @@ -55,7 +57,35 @@ Schema.AUTO_CONSUME(), KeyValueEncodingType.SEPARATED)`, and the message consist | `mongodb.password` | true | null | Password to be used when connecting to MongoDB. This is required only when MongoDB is configured to use authentication. | | `mongodb.task.id` | true | null | The taskId of the MongoDB connector that attempts to use a separate task for each replica set. | +### Customize the Reader config for the metadata topics +:::note + +The customization is only available in 2.10.2 and later versions. + +::: + +The Debezium Connector exposes `database.history.pulsar.reader.config` and `offset.storage.reader.config` to configure the reader of database schema history topic and the Kafka connector offsets topic. For example, it can be used to configure the subscription name and other reader configurations. You can find the available configurations at [ReaderConfigurationData](https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ReaderConfigurationData.java). + +For example, to configure the subscription name for both Readers, you can add the following configuration: +* JSON + + ```json + { + "configs": { + "database.history.pulsar.reader.config": "{\"subscriptionName\":\"history-reader\"}", + "offset.storage.reader.config": "{\"subscriptionName\":\"offset-reader\"}", + } + } + ``` + +* YAML + + ```yaml + configs: + database.history.pulsar.reader.config: "{\"subscriptionName\":\"history-reader\"}" + offset.storage.reader.config: "{\"subscriptionName\":\"offset-reader\"}" + ``` ## Example of MySQL diff --git a/site2/website/versioned_docs/version-2.10.x/security-basic-auth.md b/site2/website/versioned_docs/version-2.10.x/security-basic-auth.md index 2585526bb478a..5cce10fdc3fb0 100644 --- a/site2/website/versioned_docs/version-2.10.x/security-basic-auth.md +++ b/site2/website/versioned_docs/version-2.10.x/security-basic-auth.md @@ -30,7 +30,9 @@ Install [`htpasswd`](https://httpd.apache.org/docs/2.4/programs/htpasswd.html) i ## Create your authentication file :::note + Currently, you can use MD5 (recommended) and CRYPT encryption to authenticate your password. + ::: Create a password file named `.htpasswd` with a user account `superuser/admin`: @@ -55,53 +57,63 @@ superuser:$apr1$GBIYZYFZ$MzLcPrvoUky16mLcK6UtX/ ## Enable basic authentication on brokers -To configure brokers to authenticate clients, complete the following steps. - -1. Add the following parameters to the `conf/broker.conf` file. If you use a standalone Pulsar, you need to add these parameters to the `conf/standalone.conf` file. - - ``` - # Configuration to enable Basic authentication - authenticationEnabled=true - authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +To configure brokers to authenticate clients, add the following parameters to the `conf/broker.conf` file. If you use a standalone Pulsar, you need to add these parameters to the `conf/standalone.conf` file. + +```conf +# Configuration to enable Basic authentication +authenticationEnabled=true +authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +basicAuthConf=file:///path/to/.htpasswd +# basicAuthConf=/path/to/.htpasswd +# When use the base64 format, you need to encode the .htpaswd content to bas64 +# basicAuthConf=data:;base64,YOUR-BASE64 +# basicAuthConf=YOUR-BASE64 +# Authentication settings of the broker itself. Used when the broker connects to other brokers, either in same or other clusters +brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic +brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +# If this flag is set then the broker authenticates the original Auth data +# else it just accepts the originalPrincipal and authorizes it (if required). +authenticateOriginalAuthData=true +``` - # Authentication settings of the broker itself. Used when the broker connects to other brokers, either in same or other clusters - brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic - brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +:::note - # If this flag is set then the broker authenticates the original Auth data - # else it just accepts the originalPrincipal and authorizes it (if required). - authenticateOriginalAuthData=true - ``` +You can also set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. -2. Set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. +::: ## Enable basic authentication on proxies -To configure proxies to authenticate clients, complete the following steps. - -1. Add the following parameters to the `conf/proxy.conf` file: - - ``` - # For clients connecting to the proxy - authenticationEnabled=true - authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +To configure proxies to authenticate clients, add the following parameters to the `conf/proxy.conf` file. + +```conf +# For clients connecting to the proxy +authenticationEnabled=true +authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +basicAuthConf=file:///path/to/.htpasswd +# basicAuthConf=/path/to/.htpasswd +# When use the base64 format, you need to encode the .htpaswd content to bas64 +# basicAuthConf=data:;base64,YOUR-BASE64 +# basicAuthConf=YOUR-BASE64 +# For the proxy to connect to brokers +brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic +brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +# Whether client authorization credentials are forwarded to the broker for re-authorization. +# Authentication must be enabled via authenticationEnabled=true for this to take effect. +forwardAuthorizationCredentials=true +``` - # For the proxy to connect to brokers - brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic - brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +:::note - # Whether client authorization credentials are forwarded to the broker for re-authorization. - # Authentication must be enabled via authenticationEnabled=true for this to take effect. - forwardAuthorizationCredentials=true - ``` +You can also set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. -2. Set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. +::: ## Configure basic authentication in CLI tools [Command-line tools](/docs/next/reference-cli-tools), such as [Pulsar-admin](/tools/pulsar-admin/), [Pulsar-perf](/tools/pulsar-perf/) and [Pulsar-client](/tools/pulsar-client/), use the `conf/client.conf` file in your Pulsar installation. To configure basic authentication in Pulsar CLI tools, you need to add the following parameters to the `conf/client.conf` file. -``` +```conf authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic authParams={"userId":"superuser","password":"admin"} ``` @@ -124,4 +136,20 @@ The following example shows how to configure basic authentication when using Pul ``` + + + ```c++ + #include + + int main() { + pulsar::ClientConfiguration config; + AuthenticationPtr auth = pulsar::AuthBasic::create("admin", "123456") + config.setAuth(auth); + pulsar::Client client("pulsar://broker.example.com:6650/", config); + + return 0; + } + ``` + + diff --git a/site2/website/versioned_docs/version-2.8.x/security-basic-auth.md b/site2/website/versioned_docs/version-2.8.x/security-basic-auth.md index 2585526bb478a..5cce10fdc3fb0 100644 --- a/site2/website/versioned_docs/version-2.8.x/security-basic-auth.md +++ b/site2/website/versioned_docs/version-2.8.x/security-basic-auth.md @@ -30,7 +30,9 @@ Install [`htpasswd`](https://httpd.apache.org/docs/2.4/programs/htpasswd.html) i ## Create your authentication file :::note + Currently, you can use MD5 (recommended) and CRYPT encryption to authenticate your password. + ::: Create a password file named `.htpasswd` with a user account `superuser/admin`: @@ -55,53 +57,63 @@ superuser:$apr1$GBIYZYFZ$MzLcPrvoUky16mLcK6UtX/ ## Enable basic authentication on brokers -To configure brokers to authenticate clients, complete the following steps. - -1. Add the following parameters to the `conf/broker.conf` file. If you use a standalone Pulsar, you need to add these parameters to the `conf/standalone.conf` file. - - ``` - # Configuration to enable Basic authentication - authenticationEnabled=true - authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +To configure brokers to authenticate clients, add the following parameters to the `conf/broker.conf` file. If you use a standalone Pulsar, you need to add these parameters to the `conf/standalone.conf` file. + +```conf +# Configuration to enable Basic authentication +authenticationEnabled=true +authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +basicAuthConf=file:///path/to/.htpasswd +# basicAuthConf=/path/to/.htpasswd +# When use the base64 format, you need to encode the .htpaswd content to bas64 +# basicAuthConf=data:;base64,YOUR-BASE64 +# basicAuthConf=YOUR-BASE64 +# Authentication settings of the broker itself. Used when the broker connects to other brokers, either in same or other clusters +brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic +brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +# If this flag is set then the broker authenticates the original Auth data +# else it just accepts the originalPrincipal and authorizes it (if required). +authenticateOriginalAuthData=true +``` - # Authentication settings of the broker itself. Used when the broker connects to other brokers, either in same or other clusters - brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic - brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +:::note - # If this flag is set then the broker authenticates the original Auth data - # else it just accepts the originalPrincipal and authorizes it (if required). - authenticateOriginalAuthData=true - ``` +You can also set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. -2. Set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. +::: ## Enable basic authentication on proxies -To configure proxies to authenticate clients, complete the following steps. - -1. Add the following parameters to the `conf/proxy.conf` file: - - ``` - # For clients connecting to the proxy - authenticationEnabled=true - authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +To configure proxies to authenticate clients, add the following parameters to the `conf/proxy.conf` file. + +```conf +# For clients connecting to the proxy +authenticationEnabled=true +authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +basicAuthConf=file:///path/to/.htpasswd +# basicAuthConf=/path/to/.htpasswd +# When use the base64 format, you need to encode the .htpaswd content to bas64 +# basicAuthConf=data:;base64,YOUR-BASE64 +# basicAuthConf=YOUR-BASE64 +# For the proxy to connect to brokers +brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic +brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +# Whether client authorization credentials are forwarded to the broker for re-authorization. +# Authentication must be enabled via authenticationEnabled=true for this to take effect. +forwardAuthorizationCredentials=true +``` - # For the proxy to connect to brokers - brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic - brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +:::note - # Whether client authorization credentials are forwarded to the broker for re-authorization. - # Authentication must be enabled via authenticationEnabled=true for this to take effect. - forwardAuthorizationCredentials=true - ``` +You can also set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. -2. Set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. +::: ## Configure basic authentication in CLI tools [Command-line tools](/docs/next/reference-cli-tools), such as [Pulsar-admin](/tools/pulsar-admin/), [Pulsar-perf](/tools/pulsar-perf/) and [Pulsar-client](/tools/pulsar-client/), use the `conf/client.conf` file in your Pulsar installation. To configure basic authentication in Pulsar CLI tools, you need to add the following parameters to the `conf/client.conf` file. -``` +```conf authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic authParams={"userId":"superuser","password":"admin"} ``` @@ -124,4 +136,20 @@ The following example shows how to configure basic authentication when using Pul ``` + + + ```c++ + #include + + int main() { + pulsar::ClientConfiguration config; + AuthenticationPtr auth = pulsar::AuthBasic::create("admin", "123456") + config.setAuth(auth); + pulsar::Client client("pulsar://broker.example.com:6650/", config); + + return 0; + } + ``` + + diff --git a/site2/website/versioned_docs/version-2.9.x/io-debezium-source.md b/site2/website/versioned_docs/version-2.9.x/io-debezium-source.md index e7dc56cf54cdd..f739a4cdc4903 100644 --- a/site2/website/versioned_docs/version-2.9.x/io-debezium-source.md +++ b/site2/website/versioned_docs/version-2.9.x/io-debezium-source.md @@ -29,6 +29,8 @@ The configuration of Debezium source connector has the following properties. | `database.history.pulsar.service.url` | true | null | Pulsar cluster service URL for history topic. | | `offset.storage.topic` | true | null | Record the last committed offsets that the connector successfully completes. | | `json-with-envelope` | false | false | Present the message only consist of payload. +| `database.history.pulsar.reader.config` | false | null | The configs of the reader for the database schema history topic, in the form of a JSON string with key-value pairs.
    **Note:** This property is only available in 2.9.4 and later versions. | +| `offset.storage.reader.config` | false | null | The configs of the reader for the kafka connector offsets topic, in the form of a JSON string with key-value pairs.
    **Note:** This property is only available in 2.9.4 and later versions.| ### Converter Options @@ -55,7 +57,35 @@ Schema.AUTO_CONSUME(), KeyValueEncodingType.SEPARATED)`, and the message consist | `mongodb.password` | true | null | Password to be used when connecting to MongoDB. This is required only when MongoDB is configured to use authentication. | | `mongodb.task.id` | true | null | The taskId of the MongoDB connector that attempts to use a separate task for each replica set. | +### Customize the Reader config for the metadata topics +:::note + +The customization is only available in 2.9.4 and later versions. + +::: + +The Debezium Connector exposes `database.history.pulsar.reader.config` and `offset.storage.reader.config` to configure the reader of database schema history topic and the Kafka connector offsets topic. For example, it can be used to configure the subscription name and other reader configurations. You can find the available configurations at [ReaderConfigurationData](https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ReaderConfigurationData.java). + +For example, to configure the subscription name for both Readers, you can add the following configuration: +* JSON + + ```json + { + "configs": { + "database.history.pulsar.reader.config": "{\"subscriptionName\":\"history-reader\"}", + "offset.storage.reader.config": "{\"subscriptionName\":\"offset-reader\"}", + } + } + ``` + +* YAML + + ```yaml + configs: + database.history.pulsar.reader.config: "{\"subscriptionName\":\"history-reader\"}" + offset.storage.reader.config: "{\"subscriptionName\":\"offset-reader\"}" + ``` ## Example of MySQL diff --git a/site2/website/versioned_docs/version-2.9.x/security-basic-auth.md b/site2/website/versioned_docs/version-2.9.x/security-basic-auth.md index 2585526bb478a..80cb0edeaec8d 100644 --- a/site2/website/versioned_docs/version-2.9.x/security-basic-auth.md +++ b/site2/website/versioned_docs/version-2.9.x/security-basic-auth.md @@ -30,7 +30,9 @@ Install [`htpasswd`](https://httpd.apache.org/docs/2.4/programs/htpasswd.html) i ## Create your authentication file :::note + Currently, you can use MD5 (recommended) and CRYPT encryption to authenticate your password. + ::: Create a password file named `.htpasswd` with a user account `superuser/admin`: @@ -55,58 +57,67 @@ superuser:$apr1$GBIYZYFZ$MzLcPrvoUky16mLcK6UtX/ ## Enable basic authentication on brokers -To configure brokers to authenticate clients, complete the following steps. - -1. Add the following parameters to the `conf/broker.conf` file. If you use a standalone Pulsar, you need to add these parameters to the `conf/standalone.conf` file. - - ``` - # Configuration to enable Basic authentication - authenticationEnabled=true - authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +To configure brokers to authenticate clients, add the following parameters to the `conf/broker.conf` file. If you use a standalone Pulsar, you need to add these parameters to the `conf/standalone.conf` file. + +```conf +# Configuration to enable Basic authentication +authenticationEnabled=true +authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +basicAuthConf=file:///path/to/.htpasswd +# basicAuthConf=/path/to/.htpasswd +# When use the base64 format, you need to encode the .htpaswd content to bas64 +# basicAuthConf=data:;base64,YOUR-BASE64 +# basicAuthConf=YOUR-BASE64 +# Authentication settings of the broker itself. Used when the broker connects to other brokers, either in same or other clusters +brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic +brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +# If this flag is set then the broker authenticates the original Auth data +# else it just accepts the originalPrincipal and authorizes it (if required). +authenticateOriginalAuthData=true +``` - # Authentication settings of the broker itself. Used when the broker connects to other brokers, either in same or other clusters - brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic - brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +:::note - # If this flag is set then the broker authenticates the original Auth data - # else it just accepts the originalPrincipal and authorizes it (if required). - authenticateOriginalAuthData=true - ``` +You can also set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. -2. Set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. +::: ## Enable basic authentication on proxies -To configure proxies to authenticate clients, complete the following steps. - -1. Add the following parameters to the `conf/proxy.conf` file: - - ``` - # For clients connecting to the proxy - authenticationEnabled=true - authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +To configure proxies to authenticate clients, add the following parameters to the `conf/proxy.conf` file. + +```conf +# For clients connecting to the proxy +authenticationEnabled=true +authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic +basicAuthConf=file:///path/to/.htpasswd +# basicAuthConf=/path/to/.htpasswd +# When use the base64 format, you need to encode the .htpaswd content to bas64 +# basicAuthConf=data:;base64,YOUR-BASE64 +# basicAuthConf=YOUR-BASE64 +# For the proxy to connect to brokers +brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic +brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +# Whether client authorization credentials are forwarded to the broker for re-authorization. +# Authentication must be enabled via authenticationEnabled=true for this to take effect. +forwardAuthorizationCredentials=true +``` - # For the proxy to connect to brokers - brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic - brokerClientAuthenticationParameters={"userId":"superuser","password":"admin"} +:::note - # Whether client authorization credentials are forwarded to the broker for re-authorization. - # Authentication must be enabled via authenticationEnabled=true for this to take effect. - forwardAuthorizationCredentials=true - ``` +You can also set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. -2. Set an environment variable named `PULSAR_EXTRA_OPTS` and the value is `-Dpulsar.auth.basic.conf=/path/to/.htpasswd`. Pulsar reads this environment variable to implement HTTP basic authentication. +::: ## Configure basic authentication in CLI tools [Command-line tools](/docs/next/reference-cli-tools), such as [Pulsar-admin](/tools/pulsar-admin/), [Pulsar-perf](/tools/pulsar-perf/) and [Pulsar-client](/tools/pulsar-client/), use the `conf/client.conf` file in your Pulsar installation. To configure basic authentication in Pulsar CLI tools, you need to add the following parameters to the `conf/client.conf` file. -``` +```conf authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic authParams={"userId":"superuser","password":"admin"} ``` - ## Configure basic authentication in Pulsar clients The following example shows how to configure basic authentication when using Pulsar clients. @@ -124,4 +135,20 @@ The following example shows how to configure basic authentication when using Pul ``` + + + ```c++ + #include + + int main() { + pulsar::ClientConfiguration config; + AuthenticationPtr auth = pulsar::AuthBasic::create("admin", "123456") + config.setAuth(auth); + pulsar::Client client("pulsar://broker.example.com:6650/", config); + + return 0; + } + ``` + +