sijie closed pull request #2188: client configuration on authentication page is out of date URL: https://github.com/apache/incubator-pulsar/pull/2188
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/site/docs/latest/security/athenz.md b/site/docs/latest/security/athenz.md index 1218330efb..3734cd7bb6 100644 --- a/site/docs/latest/security/athenz.md +++ b/site/docs/latest/security/athenz.md @@ -90,7 +90,7 @@ You’ll need to add the following authentication parameters to that file to use ```properties # URL for the broker -serviceUrl=https://broker.example.com:8443/ +webServiceUrl=https://broker.example.com:8443/ # Set Athenz auth plugin and its parameters authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationAthenz diff --git a/site/docs/latest/security/authorization.md b/site/docs/latest/security/authorization.md index c0c58eeb62..c24c70c9e0 100644 --- a/site/docs/latest/security/authorization.md +++ b/site/docs/latest/security/authorization.md @@ -74,36 +74,19 @@ needs to be able to publish to other clusters' topics. ## Pulsar admin authentication -```java -String authPluginClassName = "com.org.MyAuthPluginClass"; -String authParams = "param1:value1"; -boolean useTls = false; -boolean tlsAllowInsecureConnection = false; -String tlsTrustCertsFilePath = null; - -ClientConfiguration config = new ClientConfiguration(); -config.setAuthentication(authPluginClassName, authParams); -config.setUseTls(useTls); -config.setTlsAllowInsecureConnection(tlsAllowInsecureConnection); -config.setTlsTrustCertsFilePath(tlsTrustCertsFilePath); - -PulsarAdmin admin = new PulsarAdmin(url, config); -``` - To use TLS: ```java +String url = "https://my-broker.example.com:8443"; String authPluginClassName = "com.org.MyAuthPluginClass"; String authParams = "param1:value1"; -boolean useTls = false; boolean tlsAllowInsecureConnection = false; -String tlsTrustCertsFilePath = null; - -ClientConfiguration config = new ClientConfiguration(); -config.setAuthentication(authPluginClassName, authParams); -config.setUseTls(useTls); -config.setTlsAllowInsecureConnection(tlsAllowInsecureConnection); -config.setTlsTrustCertsFilePath(tlsTrustCertsFilePath); - -PulsarAdmin admin = new PulsarAdmin(url, config); +String tlsTrustCertsFilePath = "/path/to/tls-trust-certs-file"; + +PulsarAdmin admin = PulsarAdmin.builder() + .serviceHttpUrl(url) + .authentication(authPluginClassName, authParams) + .allowTlsInsecureConnection(tlsAllowInsecureConnection) + .tlsTrustCertsFilePath(tlsTrustCertsFilePath) + .build(); ``` diff --git a/site/docs/latest/security/tls.md b/site/docs/latest/security/tls.md index f343eeeb9c..dcedd04b61 100644 --- a/site/docs/latest/security/tls.md +++ b/site/docs/latest/security/tls.md @@ -152,7 +152,7 @@ For more information on Pulsar client authentication using TLS, see the followin You'll need to add the following authentication parameters to that file to use TLS with Pulsar's CLI tools: ```properties -serviceUrl=https://broker.example.com:8443/ +webServiceUrl=https://broker.example.com:8443/ authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationTls authParams=tlsCertFile:/path/to/client-cert.pem,tlsKeyFile:/path/to/client-key.pem useTls=true ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
