Configure IP-based adaptive authentication¶
This page guides you through configuring IP-based adaptive authentication for a sample web application.
Consider a scenario where the internal IPs of an organization are as follows:
10.100.0.0/16. The login flow should be stepped up with TOTP when users log in from outside this IP range as follows:
- Username and password
Users who log in from the internal network should be allowed to simply log in with their username and password.
- You need to set up the sample application.
- You need to add a user named
Alexwith login permissions. Do not assign any roles to this user.
Configure IP-based authentication¶
On the management console, go to Main > Identity > Service Providers > List.
Click Edit on the
Expand the Local and Outbound Authentication Configuration section and click Advanced Configuration.
You will be redirected to Advanced Configuration, expand Script Based Conditional Authentication.
In the Templates section, click on the
+corresponding to the IP-Based template.
Click Ok to add the authentication script. The authentication script and authentication steps will be configured.
- The authentication script prompts the second step of authentication for users who log in from an IP address that is not included within the network range configured in the script.
- By default,
TOTPwill be added as the second authentication step.
corpNetworkvariable; two-factor authentication should apply when users log in from outside this range.
var corpNetwork = ['192.168.1.0/24', '10.100.0.0/16'];
Click Update to save your configurations.
Try it out¶
Access the following sample Pickup Dispatch application URL:
Click Login and enter Alex's credentials.
Note that you are successfully logged in after only the basic authentication step because you are logging in from an IP address that is within the configured network.
Log out of the application, and log in with a user not belonging to the configured IP address range. TOTP authentication is prompted.
You can also try this scenario with two different machines in different networks to simulate a real-world scenario.