Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: VLTCLT-21 allow multiple request contexts to check policies #413

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lib/IAMClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ class VaultClient {
/**
* Get policy evaluation (without authentication first)
* @param {Object} requestContextParams - parameters needed to construct
* requestContext in Vault
* requestContext in Vault, can be an array of request contexts
* @param {Object} requestContextParams.constantParams -
* params that have the
* same value for each requestContext to be constructed in Vault
Expand All @@ -788,10 +788,16 @@ class VaultClient {
* @returns{undefined}
*/
checkPolicies(requestContextParams, userArn, options, callback) {
assert(typeof requestContextParams === 'object',
'need requestContextParams');
assert(typeof requestContextParams.constantParams === 'object',
'need constantParams');
if (Array.isArray(requestContextParams)) {
requestContextParams.forEach(rc => {
assert.strictEqual(typeof rc, 'object');
assert.strictEqual(typeof rc.constantParams, 'object');
});
} else {
assert.strictEqual(typeof requestContextParams, 'object');
assert.strictEqual(typeof requestContextParams.constantParams, 'object');
}

assert(typeof userArn === 'string', 'need user arn');
const data = {
Action: 'CheckPolicies',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"engines": {
"node": ">=16"
},
"version": "7.10.9",
"version": "7.10.10",
"description": "Client library and binary for Vault, the user directory and key management service",
"main": "index.js",
"repository": "scality/vaultclient",
Expand Down