diff --git a/package-lock.json b/package-lock.json index f3f8109b..2788a37b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rules-templates", - "version": "0.21.0", + "version": "0.23.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 74ff4f90..4e219fcf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rules-templates", - "version": "0.22.0", + "version": "0.23.0", "description": "Auth0 Rules Repository", "main": "./rules", "scripts": { diff --git a/rules.json b/rules.json index 4e50bc51..b5a383db 100644 --- a/rules.json +++ b/rules.json @@ -93,24 +93,24 @@ "code": "function emailVerified(user, context, callback) {\n if (!user.email_verified) {\n return callback(\n new UnauthorizedError('Please verify your email before logging in.')\n );\n } else {\n return callback(null, user, context);\n }\n}" }, { - "id": "ip-address-blocklist", - "title": "IP Address Blocklist", - "overview": "Do not allow access to an app from a specific set of IP addresses.", + "id": "ip-address-allowlist", + "title": "IP Address allowlist", + "overview": "Only allow access to an app from a specific set of IP addresses.", "categories": [ "access control" ], - "description": "
This rule will deny access to an app from a specific set of IP addresses.
", - "code": "function ipAddressBlocklist(user, context, callback) {\n const blocklist = ['1.2.3.4', '2.3.4.5']; // unauthorized IPs\n const notAuthorized = blocklist.some(function (ip) {\n return context.request.ip === ip;\n });\n\n if (notAuthorized) {\n return callback(\n new UnauthorizedError('Access denied from this IP address.')\n );\n }\n\n return callback(null, user, context);\n}" + "description": "This rule will only allow access to an app from a specific set of IP addresses
", + "code": "function ipAddressAllowlist(user, context, callback) {\n const allowlist = ['1.2.3.4', '2.3.4.5']; // authorized IPs\n const userHasAccess = allowlist.some(function (ip) {\n return context.request.ip === ip;\n });\n\n if (!userHasAccess) {\n return callback(new Error('Access denied from this IP address.'));\n }\n\n return callback(null, user, context);\n}" }, { - "id": "ip-address-whitelist", - "title": "IP Address whitelist", - "overview": "Only allow access to an app from a specific set of IP addresses.", + "id": "ip-address-blocklist", + "title": "IP Address Blocklist", + "overview": "Do not allow access to an app from a specific set of IP addresses.", "categories": [ "access control" ], - "description": "This rule will only allow access to an app from a specific set of IP addresses
", - "code": "function ipAddressWhitelist(user, context, callback) {\n const whitelist = ['1.2.3.4', '2.3.4.5']; // authorized IPs\n const userHasAccess = whitelist.some(function (ip) {\n return context.request.ip === ip;\n });\n\n if (!userHasAccess) {\n return callback(new Error('Access denied from this IP address.'));\n }\n\n return callback(null, user, context);\n}" + "description": "This rule will deny access to an app from a specific set of IP addresses.
", + "code": "function ipAddressBlocklist(user, context, callback) {\n const blocklist = ['1.2.3.4', '2.3.4.5']; // unauthorized IPs\n const notAuthorized = blocklist.some(function (ip) {\n return context.request.ip === ip;\n });\n\n if (notAuthorized) {\n return callback(\n new UnauthorizedError('Access denied from this IP address.')\n );\n }\n\n return callback(null, user, context);\n}" }, { "id": "roles-creation", @@ -491,6 +491,16 @@ "description": "Please see the Aregnu Progressive Profiling integration for more information and detailed installation instructions.
\nRequired configuration (this Rule will be skipped if any of the below are not defined):
\nSESSION_TOKEN_SECRET
: A long, random string at least 32 bytes longARENGU_PROFILE_FORM_URL
: The URL that contains an embedded form or with a hosted form pageThis integration simplifies the process of making full use of integrated Cumul.io dashboards' multi tenant features\nby using Auth0 as its authentication layer. The integration will allow you to set up and use user\ninformation in Auth0 to filter and structure your Cumul.io dashboards.
", + "code": "function addMetadataToTokens(user, context, callback) {\n const namespace = 'https://cumulio/';\n user.user_metadata = user.user_metadata || {};\n const cumulioMetadata = user.user_metadata.cumulio || {};\n if (typeof cumulioMetadata === 'object' && cumulioMetadata !== null) {\n Object.keys(cumulioMetadata).forEach((k) => {\n context.idToken[namespace + k] = cumulioMetadata[k];\n context.accessToken[namespace + k] = cumulioMetadata[k];\n });\n } else {\n console.log(\n 'Make sure that user_metadata.cumulio is an object with keys and values'\n );\n return;\n }\n callback(null, user, context);\n}" + }, { "id": "eva-voice-biometric", "title": "EVA Voice Biometric connector", diff --git a/src/rules/a/cumulio-add-metadata-to-tokens.js b/src/rules/cumulio-add-metadata-to-tokens.js similarity index 74% rename from src/rules/a/cumulio-add-metadata-to-tokens.js rename to src/rules/cumulio-add-metadata-to-tokens.js index a69ffb8e..8ca7c2d9 100644 --- a/src/rules/a/cumulio-add-metadata-to-tokens.js +++ b/src/rules/cumulio-add-metadata-to-tokens.js @@ -4,24 +4,24 @@ * @gallery true * @category marketplace * - * This integration simplifies the process of making full use of integrated Cumul.io dashboards' multi tenant features - * by using Auth0 as its authentication layer. The integration will allow you to set up and use user + * This integration simplifies the process of making full use of integrated Cumul.io dashboards' multi tenant features + * by using Auth0 as its authentication layer. The integration will allow you to set up and use user * information in Auth0 to filter and structure your Cumul.io dashboards. */ - function addMetadataToTokens(user, context, callback) { const namespace = 'https://cumulio/'; user.user_metadata = user.user_metadata || {}; const cumulioMetadata = user.user_metadata.cumulio || {}; - if(typeof cumulioMetadata === 'object' && cumulioMetadata !== null){ + if (typeof cumulioMetadata === 'object' && cumulioMetadata !== null) { Object.keys(cumulioMetadata).forEach((k) => { context.idToken[namespace + k] = cumulioMetadata[k]; context.accessToken[namespace + k] = cumulioMetadata[k]; }); - } - else{ - console.log("Make sure that user_metadata.cumulio is an object with keys and values"); + } else { + console.log( + 'Make sure that user_metadata.cumulio is an object with keys and values' + ); return; } callback(null, user, context);