idea-toolbox
Advanced tools
Comparing version 0.8.8 to 0.8.9
20
index.js
@@ -13,2 +13,6 @@ 'use strict'; | ||
const COGNITO_USER_POOL_ID = process.env['COGNITO_USER_POOL_ID']; | ||
const COGNITO_ACCESS_KEY_ID = process.env['COGNITO_ACCESS_KEY_ID']; | ||
const COGNITO_SECRET_ACCESS_KEY = process.env['COGNITO_SECRET_ACCESS_KEY']; | ||
const S3_DEFAULT_DOWNLOAD_BUCKET = 'idea-downloads'; | ||
@@ -210,3 +214,8 @@ const S3_DEFAULT_DOWNLOAD_BUCKET_PREFIX = 'common'; | ||
*/ | ||
function cognitoGetUserByEmail(AWS, accessKeyId, secretAccessKey, cognitoUserPoolId, email, cb) { | ||
function cognitoGetUserByEmail(email, cb, accessKeyId, secretAccessKey, cognitoUserPoolId) { | ||
// read the parameters from env. var or force them | ||
accessKeyId = accessKeyId || COGNITO_ACCESS_KEY_ID; | ||
secretAccessKey = secretAccessKey || COGNITO_SECRET_ACCESS_KEY; | ||
cognitoUserPoolId = cognitoUserPoolId || COGNITO_USER_POOL_ID; | ||
// find the user by the email | ||
new AWS.CognitoIdentityServiceProvider({ | ||
@@ -218,2 +227,3 @@ apiVersion: '2016-04-18', accessKeyId: accessKeyId, secretAccessKey: secretAccessKey | ||
if(err || !data || !data.Users || !data.Users[0]) return cb(); | ||
// convert and return the attributes | ||
let userAttributes = []; | ||
@@ -228,3 +238,8 @@ data.Users[0].Attributes.forEach(a => userAttributes[a.Name] = a.Value); | ||
*/ | ||
function cognitoGetUserBySub(AWS, accessKeyId, secretAccessKey, cognitoUserPoolId, sub, cb) { | ||
function cognitoGetUserBySub(sub, cb, accessKeyId, secretAccessKey, cognitoUserPoolId) { | ||
// read the parameters from env. var or force them | ||
accessKeyId = accessKeyId || COGNITO_ACCESS_KEY_ID; | ||
secretAccessKey = secretAccessKey || COGNITO_SECRET_ACCESS_KEY; | ||
cognitoUserPoolId = cognitoUserPoolId || COGNITO_USER_POOL_ID; | ||
// find the user by the sub | ||
new AWS.CognitoIdentityServiceProvider({ | ||
@@ -236,2 +251,3 @@ apiVersion: '2016-04-18', accessKeyId: accessKeyId, secretAccessKey: secretAccessKey | ||
if(err || !data || !data.Users || !data.Users[0]) return cb(); | ||
// convert and return the attributes | ||
let userAttributes = []; | ||
@@ -238,0 +254,0 @@ data.Users[0].Attributes.forEach(a => userAttributes[a.Name] = a.Value); |
{ | ||
"name": "idea-toolbox", | ||
"version": "0.8.8", | ||
"version": "0.8.9", | ||
"description": "IDEA's utility functions", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19497
408
7