feat(All AWS Nodes): Enable support for AWS temporary credentials (#2587)

* Enable support for AWS temporary credentials

* 🔨 removed toggle from ui added sessionToken to other aws services that using sign function from aws4 module

* Update sign method for other AWS nodes

* Remove the unneeded additional `temporaryCredentials` checkbox

* Update description for session token

*  added missing session token to credentials test

* Update sign method for DynamoDB

* 🔨 added back toggle for hiding session token, fixed linter errors

*  wording fix

Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
Basit Ali
2022-04-22 19:33:09 +05:00
committed by GitHub
parent 15e6d9274a
commit ce79e6b74f
11 changed files with 90 additions and 18 deletions

View File

@@ -40,7 +40,11 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
// Concatenate path and instantiate URL object so it parses correctly query strings
const endpoint = new URL(getEndpointForService(service, credentials) + path);
const securityHeaders = {
accessKeyId: `${credentials.accessKeyId}`.trim(),
secretAccessKey: `${credentials.secretAccessKey}`.trim(),
sessionToken: credentials.temporaryCredentials ? `${credentials.sessionToken}`.trim() : undefined,
};
const options = sign({
// @ts-ignore
uri: endpoint,
@@ -50,10 +54,7 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
path: '/',
headers: { ...headers },
body: JSON.stringify(body),
}, {
accessKeyId: credentials.accessKeyId,
secretAccessKey: credentials.secretAccessKey,
});
}, securityHeaders);
try {
return JSON.parse(await this.helpers.request!(options));