node-vault-client 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/package.json +4 -2
- package/src/VaultClient.js +1 -4
- package/src/auth/VaultAppRoleAuth.js +8 -1
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Node.js Vault Client
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/namecheap/node-vault-client)
|
|
4
3
|

|
|
5
4
|

|
|
6
5
|
|
|
@@ -151,4 +150,4 @@ If no name passed all named instances will be cleared.
|
|
|
151
150
|
|
|
152
151
|
| Param | Type | Description |
|
|
153
152
|
| --- | --- | --- |
|
|
154
|
-
| [name] | <code>String</code> | Vault instance name, all instances will be cleared if no name were passed |
|
|
153
|
+
| [name] | <code>String</code> | Vault instance name, all instances will be cleared if no name were passed |
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-vault-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A Vault Client implemented in pure javascript for HashiCorp Vault. It supports variety of Auth Backends and performs lease renewal for issued auth token.",
|
|
5
|
-
"repository":
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "git+https://github.com/namecheap/node-vault-client.git"
|
|
7
|
+
},
|
|
6
8
|
"engines": {
|
|
7
9
|
"node": ">=14.0.0"
|
|
8
10
|
},
|
package/src/VaultClient.js
CHANGED
|
@@ -63,11 +63,8 @@ class VaultClient {
|
|
|
63
63
|
let instance = vaultInstances[name];
|
|
64
64
|
if (instance === undefined) {
|
|
65
65
|
vaultInstances[name] = instance = new VaultClient(options);
|
|
66
|
-
|
|
67
|
-
return instance;
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
throw new errors.InvalidArgumentsError('Instance with such name already booted');
|
|
67
|
+
return instance;
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
/**
|
|
@@ -16,6 +16,7 @@ class VaultAppRoleAuth extends VaultBaseAuth {
|
|
|
16
16
|
|
|
17
17
|
this.__roleId = config.role_id;
|
|
18
18
|
this.__secretId = config.secret_id;
|
|
19
|
+
this.__namespace = config.namespace;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
_authenticate() {
|
|
@@ -23,10 +24,16 @@ class VaultAppRoleAuth extends VaultBaseAuth {
|
|
|
23
24
|
'making authentication request: role_id=%s',
|
|
24
25
|
this.__roleId
|
|
25
26
|
);
|
|
27
|
+
|
|
28
|
+
const headers = {};
|
|
29
|
+
if (this.__namespace) {
|
|
30
|
+
headers['X-Vault-Namespace'] = this.__namespace;
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
return this.__apiClient.makeRequest('POST', `/auth/${this._mount}/login`, {
|
|
27
34
|
role_id: this.__roleId,
|
|
28
35
|
secret_id: this.__secretId,
|
|
29
|
-
}).then(res => {
|
|
36
|
+
}, headers).then(res => {
|
|
30
37
|
this._log.debug(
|
|
31
38
|
'receive token: %s',
|
|
32
39
|
res.auth.client_token
|