This is an automated email from the ASF dual-hosted git repository.

massakam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git


The following commit(s) were added to refs/heads/master by this push:
     new b8e6276  Add type definition for AthenzX509Config (#358)
b8e6276 is described below

commit b8e6276658be62c25bad50b402d953fa9cf28b13
Author: hrsakai <[email protected]>
AuthorDate: Fri Dec 8 14:13:58 2023 +0900

    Add type definition for AthenzX509Config (#358)
---
 index.d.ts | 15 ++++++++++++++-
 tstest.ts  | 10 ++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/index.d.ts b/index.d.ts
index 4e610b2..91f13ed 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -186,7 +186,7 @@ export class AuthenticationTls {
 }
 
 export class AuthenticationAthenz {
-  constructor(params: string | AthenzConfig);
+  constructor(params: string | AthenzConfig | AthenzX509Config);
 }
 
 export interface AthenzConfig {
@@ -198,9 +198,22 @@ export interface AthenzConfig {
   keyId?: string;
   principalHeader?: string;
   roleHeader?: string;
+  caCert?: string;
+  /**
+   * @deprecated
+   */
   tokenExpirationTime?: string;
 }
 
+export class AthenzX509Config {
+  providerDomain: string;
+  privateKey: string;
+  x509CertChain: string;
+  ztsUrl: string;
+  roleHeader?: string;
+  caCert?: string;
+}
+
 export class AuthenticationToken {
   constructor(params: { token: string });
 }
diff --git a/tstest.ts b/tstest.ts
index 568e0b0..c1b81a3 100644
--- a/tstest.ts
+++ b/tstest.ts
@@ -37,6 +37,16 @@ import Pulsar = require('./index');
     principalHeader: 'Athenz-Principal-Auth',
     roleHeader: 'Athenz-Role-Auth',
     tokenExpirationTime: '3600',
+    caCert: 'file:///path/to/cacert.pem',
+  });
+
+  const authAthenz3: Pulsar.AuthenticationAthenz = new 
Pulsar.AuthenticationAthenz({
+    providerDomain: 'athenz.provider.domain',
+    privateKey: 'file:///path/to/private.key',
+    ztsUrl: 'https://localhost:8443',
+    roleHeader: 'Athenz-Role-Auth',
+    x509CertChain: 'file:///path/to/x509cert.pem',
+    caCert: 'file:///path/to/cacert.pem',
   });
 
   const authOauth2PrivateKey: Pulsar.AuthenticationOauth2 = new 
Pulsar.AuthenticationOauth2({

Reply via email to