This is an automated email from the ASF dual-hosted git repository.
nkurihar 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 c62744d Add definition of AthenzConfig (#146)
c62744d is described below
commit c62744d2505d90711f4bcad76817387f9ba1cb35
Author: Masahiro Sakamoto <[email protected]>
AuthorDate: Wed Mar 10 12:01:27 2021 +0900
Add definition of AthenzConfig (#146)
---
index.d.ts | 14 +++++++++++++-
tstest.ts | 26 +++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/index.d.ts b/index.d.ts
index 91136d0..44e5342 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -145,7 +145,19 @@ export class AuthenticationTls {
}
export class AuthenticationAthenz {
- constructor(params: string);
+ constructor(params: string | AthenzConfig);
+}
+
+export interface AthenzConfig {
+ tenantDomain: string;
+ tenantService: string;
+ providerDomain: string;
+ privateKey: string;
+ ztsUrl: string;
+ keyId?: string;
+ principalHeader?: string;
+ roleHeader?: string;
+ tokenExpirationTime?: string;
}
export class AuthenticationToken {
diff --git a/tstest.ts b/tstest.ts
index 2236281..ca2cbbc 100644
--- a/tstest.ts
+++ b/tstest.ts
@@ -25,7 +25,19 @@ import Pulsar = require('./index');
privateKeyPath: '/path/to/key.pem',
});
- const authAthenz: Pulsar.AuthenticationAthenz = new
Pulsar.AuthenticationAthenz('{}');
+ const authAthenz1: Pulsar.AuthenticationAthenz = new
Pulsar.AuthenticationAthenz('{}');
+
+ const authAthenz2: Pulsar.AuthenticationAthenz = new
Pulsar.AuthenticationAthenz({
+ tenantDomain: 'athenz.tenant.domain',
+ tenantService: 'service',
+ providerDomain: 'athenz.provider.domain',
+ privateKey: 'file:///path/to/private.key',
+ ztsUrl: 'https://localhost:8443',
+ keyId: '0',
+ principalHeader: 'Athenz-Principal-Auth',
+ roleHeader: 'Athenz-Role-Auth',
+ tokenExpirationTime: '3600',
+ });
const authToken: Pulsar.AuthenticationToken = new
Pulsar.AuthenticationToken({
token: 'foobar',
@@ -215,6 +227,14 @@ import Pulsar = require('./index');
// Minimal parameters
(async () => {
+ const authAthenz: Pulsar.AuthenticationAthenz = new
Pulsar.AuthenticationAthenz({
+ tenantDomain: 'athenz.tenant.domain',
+ tenantService: 'service',
+ providerDomain: 'athenz.provider.domain',
+ privateKey: 'file:///path/to/private.key',
+ ztsUrl: 'https://localhost:8443',
+ });
+
const client: Pulsar.Client = new Pulsar.Client({
serviceUrl: 'pulsar://localhost:6650',
});
@@ -258,6 +278,10 @@ import Pulsar = require('./index');
// Missing required parameters
(async () => {
// $ExpectError
+ const authAthenz: Pulsar.AuthenticationAthenz = new
Pulsar.AuthenticationAthenz({
+ });
+
+ // $ExpectError
const client: Pulsar.Client = new Pulsar.Client({
});