From 9a96316dcc8b4d4054e5f49a9691dcd6b140c0d9 Mon Sep 17 00:00:00 2001 From: hrsakai Date: Fri, 8 Dec 2023 15:57:41 +0900 Subject: [PATCH 1/2] Add athenz copper argos sample code in python/nodejs --- docs/security-athenz.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/docs/security-athenz.md b/docs/security-athenz.md index 6040f67664c5..0be03729c3c6 100644 --- a/docs/security-athenz.md +++ b/docs/security-athenz.md @@ -194,7 +194,7 @@ In this case, `tenantDomain`, `tenantService` and `keyId` are ignored. ````mdx-code-block + values={[{"label":"Java","value":"Java"},{"label":"Python","value":"Python"},{"label":"C++","value":"C++"},{"label":"Node.js","value":"Node.js"},{"label":"Go","value":"Go"}]}> ```java @@ -214,6 +214,27 @@ PulsarClient client = PulsarClient.builder() .build(); ``` + + + +```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), +) +``` + @@ -231,6 +252,24 @@ config.setAuth(auth); Client client("pulsar://my-broker.com:6650", config); ``` + + + +```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 +}); + +``` From b591ee1b98b53514c9156366e698ada7f7b9b2af Mon Sep 17 00:00:00 2001 From: hrsakai Date: Fri, 8 Dec 2023 16:19:37 +0900 Subject: [PATCH 2/2] Remove unnessary description --- docs/security-athenz.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/security-athenz.md b/docs/security-athenz.md index 0be03729c3c6..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`