-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* version bump * npm run format * npm run release * move cumul.io rule * rebuild rules.json to add cumul.io rule
- Loading branch information
1 parent
2ea2be8
commit 16d75cf
Showing
4 changed files
with
29 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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": "<p>This rule will deny access to an app from a specific set of IP addresses.</p>", | ||
"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": "<p>This rule will only allow access to an app from a specific set of IP addresses</p>", | ||
"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": "<p>This rule will only allow access to an app from a specific set of IP addresses</p>", | ||
"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": "<p>This rule will deny access to an app from a specific set of IP addresses.</p>", | ||
"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": "<p>Please see the <a href=\"https://marketplace.auth0.com/integrations/arengu-progressive-profiling\">Aregnu Progressive Profiling integration</a> for more information and detailed installation instructions.</p>\n<p><strong>Required configuration</strong> (this Rule will be skipped if any of the below are not defined):</p>\n<ul>\n<li><code>SESSION_TOKEN_SECRET</code>: A long, random string at least 32 bytes long</li>\n<li><code>ARENGU_PROFILE_FORM_URL</code>: The URL that contains an <a href=\"https://github.com/arengu/forms-js-sdk#embed-a-form\">embedded form</a> or with a <a href=\"https://www.arengu.com/pages\">hosted form page</a></li>\n</ul>", | ||
"code": "async function arenguCompleteUserProfile(user, context, callback) {\n if (\n !configuration.SESSION_TOKEN_SECRET ||\n !configuration.ARENGU_PROFILE_FORM_URL\n ) {\n console.log('Missing required configuration. Skipping.');\n return callback(null, user, context);\n }\n\n const {\n Auth0RedirectRuleUtilities,\n Auth0UserUpdateUtilities\n } = require('@auth0/[email protected]');\n\n const ruleUtils = new Auth0RedirectRuleUtilities(\n user,\n context,\n configuration\n );\n\n const userUtils = new Auth0UserUpdateUtilities(user, auth0);\n\n function validateSessionToken() {\n try {\n return ruleUtils.validateSessionToken();\n } catch (error) {\n callback(error);\n }\n }\n\n // Modify your login criteria to your needs\n function isLogin() {\n const loginCount = configuration.ARENGU_PROFILE_LOGIN_COUNT || 2;\n return context.stats.loginsCount > parseInt(loginCount, 10);\n }\n\n function isEmptyUserMeta(key) {\n return (\n userUtils.getUserMeta(key) === undefined ||\n userUtils.getUserMeta(key) === null ||\n userUtils.getUserMeta(key).length === 0\n );\n }\n\n function isProfileIncomplete() {\n // Add your required user_medata keys\n return isEmptyUserMeta('job_title') || isEmptyUserMeta('company_name');\n }\n\n if (ruleUtils.isRedirectCallback && ruleUtils.queryParams.session_token) {\n const decodedToken = validateSessionToken();\n const customClaims = decodedToken.other;\n\n for (const [key, value] of Object.entries(customClaims)) {\n userUtils.setUserMeta(key, value);\n }\n\n try {\n await userUtils.updateUserMeta();\n\n return callback(null, user, context);\n } catch (error) {\n return callback(error);\n }\n }\n\n if (isLogin() && isProfileIncomplete()) {\n ruleUtils.doRedirect(configuration.ARENGU_PROFILE_FORM_URL);\n }\n\n return callback(null, user, context);\n}" | ||
}, | ||
{ | ||
"id": "cumulio-add-metadata-to-tokens", | ||
"title": "User metadata for Cumul.io", | ||
"overview": "Add Cumul.io user metadata to tokens to be used for Cumul.io dashboard filtering", | ||
"categories": [ | ||
"marketplace" | ||
], | ||
"description": "<p>This 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.</p>", | ||
"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", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters