Skip to content

Commit b8e6276

Browse files
authored
Add type definition for AthenzX509Config (#358)
1 parent 705c1fe commit b8e6276

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

index.d.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class AuthenticationTls {
186186
}
187187

188188
export class AuthenticationAthenz {
189-
constructor(params: string | AthenzConfig);
189+
constructor(params: string | AthenzConfig | AthenzX509Config);
190190
}
191191

192192
export interface AthenzConfig {
@@ -198,9 +198,22 @@ export interface AthenzConfig {
198198
keyId?: string;
199199
principalHeader?: string;
200200
roleHeader?: string;
201+
caCert?: string;
202+
/**
203+
* @deprecated
204+
*/
201205
tokenExpirationTime?: string;
202206
}
203207

208+
export class AthenzX509Config {
209+
providerDomain: string;
210+
privateKey: string;
211+
x509CertChain: string;
212+
ztsUrl: string;
213+
roleHeader?: string;
214+
caCert?: string;
215+
}
216+
204217
export class AuthenticationToken {
205218
constructor(params: { token: string });
206219
}

tstest.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ import Pulsar = require('./index');
3737
principalHeader: 'Athenz-Principal-Auth',
3838
roleHeader: 'Athenz-Role-Auth',
3939
tokenExpirationTime: '3600',
40+
caCert: 'file:///path/to/cacert.pem',
41+
});
42+
43+
const authAthenz3: Pulsar.AuthenticationAthenz = new Pulsar.AuthenticationAthenz({
44+
providerDomain: 'athenz.provider.domain',
45+
privateKey: 'file:///path/to/private.key',
46+
ztsUrl: 'https://localhost:8443',
47+
roleHeader: 'Athenz-Role-Auth',
48+
x509CertChain: 'file:///path/to/x509cert.pem',
49+
caCert: 'file:///path/to/cacert.pem',
4050
});
4151

4252
const authOauth2PrivateKey: Pulsar.AuthenticationOauth2 = new Pulsar.AuthenticationOauth2({

0 commit comments

Comments
 (0)