Configure TypingDNA-based adaptive Authentication¶
Typing DNA uses AI-based technology to authenticate users according to the way they type.
You can integrate typingDNA with MWARE IAM to provide risk-based adaptive authentication for users.
Scenario¶
Consider a scenario where you want to prompt an additional authentication step if the typing pattern of the user trying to log in does not match the typing pattern registered in the user's account. Then the log in flow of the user should be stepped up as follows:
- Basic authentication (username and password)
- TOTP
Prerequisites¶
- See the general prerequisites for all adaptive authenticaiton scenarios.
- Set up the sample application.
- Create a user named Alex with login permissions.
-
Create a typingDNA account. Learn how to create one here.
Info
Once you sign up for a typingDNA account, go to the dashboard and under API settings, enable Auto-enroll, and Force initial enrollments.
Set up TypingDNA in MWARE IAM¶
Follow the steps given below to set up typingDNA in the MWARE IAM server.
-
Open the deployment.toml file found in the
<IS-Home>/repository/conf/
directory and add the following configuration:[myaccount.security] enabled_features=["security.loginVerifyData.typingDNA"]
-
Go to the WSO2 store and download both the authenticator and the artifacts from the TypingDNA Connector.
-
Copy the Authenticator file (
org.wso2.carbon.identity.conditional.auth.typingdna.functions-x.x.x.jar
) to the<IS-Home>/repository/components/dropins
directory. -
Unzip the Artifacts archive, copy the
api#identity#typingdna#v_.war
file to the<IS-Home>/repository/deployment/server/webapps
directory. -
Restart the MWARE IAM.
-
Go to Identity Providers -> Resident -> Other Settings -> TypingDNA Configuration and make the following changes.
- Enable TypingDNA
- Configure the typingDNA API key and API secret retrieved from the typingDNA dashboard.
- Enable Advance TypingDNA-API mode if you have a pro/enterprise typingDNA account.
- Configure the region (eu or us).
-
Click Update to save the changes.
Configure TypingDNA in applications¶
Follow the steps given below to configure TypingDNA in your application.
-
Go to Service Providers -> List and click Edit on the service provider that you want to configure TypingDNA in.
-
Expand Local and Outbound Authentication Configuration and click Advanced Configuration.
-
Configure two authentication steps.
Info
In this scenario, we will configure Username and Password and TOTP.
-
Expand Script Based Adaptive Authentication and add the following script:
// This script will step up 2FA authentication if the user's typing behaviour does not match with the enrolled behaviour. // You can use the parameters 'score' (num 0-100), 'result' (boolean), 'confidence' (num 0-100), 'comparedPatterns' in your // authentication logic to trigger the 2nd step. // Only the 'result' parameter has been used in the sample script. var onLoginRequest = function(context) { executeStep(1, { onSuccess: function (context) { verifyUserWithTypingDNA(context, { onSuccess: function(context,data){ // Change the definition here as required. var userVerified = data.result; // data.isTypingPatternReceived indicates whether a typing pattern is received from the login portal. if (data.isTypingPatternReceived && !userVerified){ executeStep(2); } },onFail: function(context,data){ executeStep(2); } }); } }); };
-
Click Update to save the changes.
Try it out¶
- Access the login page of the sample application and click Log in
-
Use the credentials of Alex and log in to the application two times.
Info
You will be prompted for the second step on both occasions. TypingDNA requires two initial enrollments to register the user’s typing pattern. You can change the number of minimum initial enrollments required in the API settings of the typingDNA dashboard.
-
Log in for the third time with Alex's credentials.
Info
From this log in attempt and beyond, typingDNA will analyze your typing pattern against the registered typing pattern of the account. TOTP will only be prompted if your typing pattern does not match the typing pattern registered in Alex's account.