vvauth 2.4.0 → 2.4.1
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/index.js +1 -1
- package/package.json +1 -1
- package/test/token-cache.js +24 -0
package/index.js
CHANGED
package/package.json
CHANGED
package/test/token-cache.js
CHANGED
|
@@ -792,3 +792,27 @@ for(const inherited of ['', 'inherited-token']) {
|
|
|
792
792
|
assert.deepEqual(requests, []);
|
|
793
793
|
});
|
|
794
794
|
}
|
|
795
|
+
|
|
796
|
+
test('Windows keeps cache enabled and selects Pageant without SSH_AUTH_SOCK', async t => {
|
|
797
|
+
const {client, file} = await fixture(t);
|
|
798
|
+
const home = path.dirname(path.dirname(path.dirname(file)));
|
|
799
|
+
const rc = path.join(home, 'foundry.vauthrc');
|
|
800
|
+
fs.writeFileSync(rc, JSON.stringify({vault_addr : client().VAULT_ADDR, ssh_auth : {role : 'windows-role'}}));
|
|
801
|
+
const module_path = path.resolve(__dirname, '..', 'index.js');
|
|
802
|
+
const script = `const Vauth = require(${JSON.stringify(module_path)});
|
|
803
|
+
Object.defineProperty(process, 'platform', {value: 'win32'});
|
|
804
|
+
const instance = new Vauth();
|
|
805
|
+
const result = {cacheDisabled: instance.rc.token_cache === false, role: instance.rc.ssh_auth.role};
|
|
806
|
+
instance._read_token_cache = async () => undefined;
|
|
807
|
+
instance._save_cached_token = async () => {};
|
|
808
|
+
instance._login_vault_ssh = async (auth, agent) => {
|
|
809
|
+
result.agent = agent;
|
|
810
|
+
return {client_token: 'windows-test-token', lease_duration: 86400, renewable: true};
|
|
811
|
+
};
|
|
812
|
+
instance.connect().then(() => process.stdout.write(JSON.stringify(result))).catch(() => process.exit(1));`;
|
|
813
|
+
const output = await exec(process.execPath, ['-e', script], {
|
|
814
|
+
cwd : home,
|
|
815
|
+
env : {...process.env, VAUTHRC : rc, VAULT_TOKEN : '', SSH_AUTH_SOCK : ''},
|
|
816
|
+
});
|
|
817
|
+
assert.deepEqual(JSON.parse(output.stdout), {cacheDisabled : false, role : 'windows-role', agent : 'pageant'});
|
|
818
|
+
});
|