-
Notifications
You must be signed in to change notification settings - Fork 68
Replace Auth0 Rules with Auth0 Actions #1375
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
Open
avanscoy
wants to merge
5
commits into
main
Choose a base branch
from
fix/docs-5525
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
218a109
Replace Auth0 Rules with Auth0 Actions
avanscoy 791d509
Apply suggestion from @hazel-nut
nick-gagliardi 339eec1
chore: merge main and resolve modify/delete conflict
avanscoy 420dfa4
Updated with custom phone and email providers
avanscoy 2b72d1b
Title fix
avanscoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
41 changes: 41 additions & 0 deletions
41
main/docs/authenticate/passwordless/sample-use-cases-actions.mdx
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| --- | ||
| description: Explore examples using Actions with passwordless connections. | ||
| title: Sample Use Cases - Actions with Passwordless Authentication | ||
| --- | ||
|
|
||
| With [Actions](/docs/customize/actions/actions-overview), you can handle more complicated cases than is possible with [passwordless connections](/docs/authenticate/passwordless) alone. For instance, you can add extra precautions to further ensure possession of an email address or device. | ||
|
|
||
| ## Require Multi-factor Authentication for users who are outside the corporate network | ||
|
|
||
| Let's say you want to require [multi-factor authentication (MFA)](/docs/secure/multi-factor-authentication) for any users who are accessing the application using a <Tooltip tip="Passwordless: Form of authentication that does not rely on a password as the first factor." cta="View Glossary" href="/docs/glossary?term=passwordless">passwordless</Tooltip> connection from outside your corporate network. | ||
|
|
||
| Using an Action, you can check whether a user is authenticating using a passwordless method (`sms`, `email`) and if their session IP falls outside of the designated corporate network, prompt them for a second authentication factor. | ||
|
|
||
| <Callout icon="file-lines" color="#0EA5E9" iconType="regular"> | ||
|
|
||
| You could also trigger this Action based on other criteria, such as whether the current IP matches the user's IP allowlist or whether geolocating the user reveals they are in a different country from the one listed in their user profile. | ||
|
|
||
| </Callout> | ||
|
avanscoy marked this conversation as resolved.
Outdated
|
||
|
|
||
| To do this, [create a Post-Login Action](/docs/customize/actions/write-your-first-action) with the following code. Before deploying, add `ipaddr.js` as an npm dependency in the Action editor. | ||
|
|
||
| ```javascript lines | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we may want to add something like, "in the provider configuration, add" so it doesn't just jump into code for them |
||
| const ipaddr = require('ipaddr.js'); | ||
|
|
||
| exports.onExecutePostLogin = async (event, api) => { | ||
| const corp_network = "192.168.1.134/26"; | ||
|
avanscoy marked this conversation as resolved.
Outdated
|
||
| const current_ip = ipaddr.parse(event.request.ip); | ||
| // is auth method passwordless and IP outside corp network? | ||
| const passwordlessOutside = event.authentication.methods.find( | ||
| (method) => ( | ||
| ((method.name === 'sms') || (method.name === 'email')) && | ||
| (!current_ip.match(ipaddr.parseCIDR(corp_network))) | ||
| ) | ||
| ); | ||
|
|
||
| // if yes, then require MFA | ||
| if (passwordlessOutside) { | ||
|
nick-gagliardi marked this conversation as resolved.
Outdated
|
||
| api.multifactor.enable('any', { allowRememberBrowser: false }); | ||
| } | ||
| }; | ||
| ``` | ||
58 changes: 0 additions & 58 deletions
58
main/docs/authenticate/passwordless/sample-use-cases-rules.mdx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.