This is an automated email from the ASF dual-hosted git repository.
nkurihar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git
The following commit(s) were added to refs/heads/main by this push:
new 8240d604bc73 [improve][doc]Add athenz copper argos sample code in
python/nodejs (#747)
8240d604bc73 is described below
commit 8240d604bc73e94853a594e4afb923f4c22d8ccd
Author: hrsakai <[email protected]>
AuthorDate: Tue Dec 12 17:22:45 2023 +0900
[improve][doc]Add athenz copper argos sample code in python/nodejs (#747)
* Add athenz copper argos sample code in python/nodejs
* Remove unnessary description
---
docs/security-athenz.md | 43 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 2 deletions(-)
diff --git a/docs/security-athenz.md b/docs/security-athenz.md
index 6040f67664c5..de290474ee68 100644
--- a/docs/security-athenz.md
+++ b/docs/security-athenz.md
@@ -183,7 +183,7 @@ client, err := pulsar.NewClient(pulsar.ClientOptions{
Athenz has a mechanism called [Copper
Argos](https://github.com/AthenZ/athenz/blob/master/docs/copper_argos.md). This
means that ZTS distributes an X.509 certificate and private key pair to each
service, which it can use to identify itself to other services within the
organization.
-Currently, Pulsar supports Copper Argos in Java, C++, and Go. When using
Copper Argos, you need to provide at least the following four parameters:
+When using Copper Argos, you need to provide at least the following four
parameters:
* `providerDomain`
* `x509CertChain`
* `privateKey`
@@ -194,7 +194,7 @@ In this case, `tenantDomain`, `tenantService` and `keyId`
are ignored.
````mdx-code-block
<Tabs groupId="lang-choice"
defaultValue="Java"
-
values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"},{"label":"Go","value":"Go"}]}>
+
values={[{"label":"Java","value":"Java"},{"label":"Python","value":"Python"},{"label":"C++","value":"C++"},{"label":"Node.js","value":"Node.js"},{"label":"Go","value":"Go"}]}>
<TabItem value="Java">
```java
@@ -214,6 +214,27 @@ PulsarClient client = PulsarClient.builder()
.build();
```
+</TabItem>
+<TabItem value="Python">
+
+```python
+authPlugin = "athenz"
+authParams = """
+{
+"ztsUrl": "http://localhost:9998",
+"providerDomain": "pulsar",
+"x509CertChain": "file:///path/to/x509cert.pem",
+"privateKey": "file:///path/to/private.pem",
+"caCert": "file:///path/to/cacert.pem"
+}
+"""
+
+client = Client(
+ "pulsar://my-broker.com:6650",
+ authentication=Authentication(authPlugin, authParams),
+)
+```
+
</TabItem>
<TabItem value="C++">
@@ -231,6 +252,24 @@ config.setAuth(auth);
Client client("pulsar://my-broker.com:6650", config);
```
+</TabItem>
+<TabItem value="Node.js">
+
+```javascript
+const auth = new Pulsar.AuthenticationAthenz({
+ ztsUrl: "http://localhost:9998",
+ providerDomain: "pulsar",
+ x509CertChain: "file:///path/to/x509cert.pem",
+ privateKey: "file:///path/to/private.pem",
+ caCert: "file:///path/to/cacert.pem"
+});
+
+const client = new Pulsar.Client({
+ serviceUrl: 'pulsar://my-broker.com:6650',
+ authentication: auth
+});
+
+```
</TabItem>
<TabItem value="Go">