UNPKG

3.27 kBTypeScriptView Raw
1/**
2 * IPasswordAuthenticator specifies an authenticator which uses an RBAC
3 * username and password to authenticate with the cluster.
4 *
5 * @category Authentication
6 */
7export interface IPasswordAuthenticator {
8 /**
9 * The username to authenticate with.
10 */
11 username: string;
12 /**
13 * The password to autehnticate with.
14 */
15 password: string;
16 /**
17 * The sasl mechanisms to authenticate with.
18 */
19 allowed_sasl_mechanisms?: string[];
20}
21/**
22 * IPasswordAuthenticator specifies an authenticator which uses an SSL
23 * certificate and key to authenticate with the cluster.
24 *
25 * @category Authentication
26 */
27export interface ICertificateAuthenticator {
28 /**
29 * The path to the certificate which should be used for certificate authentication.
30 */
31 certificatePath: string;
32 /**
33 * The path to the key which should be used for certificate authentication.
34 */
35 keyPath: string;
36}
37/**
38 * PasswordAuthenticator implements a simple IPasswordAuthenticator.
39 *
40 * @category Authentication
41 */
42export declare class PasswordAuthenticator implements IPasswordAuthenticator {
43 /**
44 * The username that will be used to authenticate with.
45 */
46 username: string;
47 /**
48 * The password that will be used to authenticate with.
49 */
50 password: string;
51 /**
52 * The sasl mechanisms to authenticate with.
53 */
54 allowed_sasl_mechanisms?: string[] | undefined;
55 /**
56 * Constructs this PasswordAuthenticator with the passed username and password.
57 *
58 * @param username The username to initialize this authenticator with.
59 * @param password The password to initialize this authenticator with.
60 */
61 constructor(username: string, password: string);
62 /**
63 * Creates a LDAP compatible password authenticator which is INSECURE if not used with TLS.
64 *
65 * Please note that this is INSECURE and will leak user credentials on the wire to eavesdroppers.
66 * This should only be enabled in trusted environments.
67 *
68 * @param username The username to initialize this authenticator with.
69 * @param password The password to initialize this authenticator with.
70 */
71 static ldapCompatible(username: string, password: string): PasswordAuthenticator;
72}
73/**
74 * CertificateAuthenticator implements a simple ICertificateAuthenticator.
75 *
76 * @category Authentication
77 */
78export declare class CertificateAuthenticator implements ICertificateAuthenticator {
79 /**
80 * The path to the certificate which should be used for certificate authentication.
81 */
82 certificatePath: string;
83 /**
84 * The path to the key which should be used for certificate authentication.
85 */
86 keyPath: string;
87 /**
88 * Constructs this CertificateAuthenticator with the passed certificate and key paths.
89 *
90 * @param certificatePath The certificate path to initialize this authenticator with.
91 * @param keyPath The key path to initialize this authenticator with.
92 */
93 constructor(certificatePath: string, keyPath: string);
94}
95/**
96 * Represents any of the valid authenticators that could be passed to the SDK.
97 *
98 * @category Authentication
99 */
100export type Authenticator = IPasswordAuthenticator | ICertificateAuthenticator;