Skip to content

Commit e9aeb52

Browse files
Merge pull request #5980 from ZiyamSanthosh/sift-connector-docs-3
Add Sift v2 documentation and preserve v1 documentation
2 parents 87d1fad + a20dbc6 commit e9aeb52

9 files changed

Lines changed: 344 additions & 4 deletions

File tree

249 KB
Loading

en/identity-server/next/docs/connectors/sift/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
template: templates/connector.html
33
---
44

5-
{% include "../../../../../includes/connectors/sift/overview.md" %}
5+
{% include "../../../../../includes/connectors/sift-v2/overview.md" %}

en/identity-server/next/docs/connectors/sift/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
template: templates/connector.html
33
---
44

5-
{% include "../../../../../includes/connectors/sift/reference.md" %}
5+
{% include "../../../../../includes/connectors/sift-v2/reference.md" %}

en/identity-server/next/docs/connectors/sift/set-up.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
template: templates/connector.html
33
---
44

5-
{% include "../../../../../includes/connectors/sift/set-up.md" %}
5+
{% include "../../../../../includes/connectors/sift-v2/set-up.md" %}

en/identity-server/next/docs/connectors/sift/usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
template: templates/connector.html
33
---
44

5-
{% include "../../../../../includes/connectors/sift/usage.md" %}
5+
{% include "../../../../../includes/connectors/sift-v2/usage.md" %}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Sift
2+
3+
[Sift](https://sift.com/){:target="_blank"} helps businesses prevent fraud, abuse, and account takeovers by analyzing user behavior and contextual data in real time. By combining signals like device fingerprinting, IP reputation, and behavioral patterns, Sift creates a dynamic risk score that helps businesses make smarter decisions and reduce false positives.
4+
5+
You can integrate {{product_name}} with Sift to assess the risk level of login attempts. During authentication, {{product_name}} sends relevant contextual data to Sift. Sift then evaluates the request and returns either a risk score or a decision ID. Based on this response, you can decide to:
6+
7+
- Allow the login.
8+
- Deny the login.
9+
- Trigger additional verification (e.g., MFA).
10+
11+
The following sections describe two common use cases for integrating {{product_name}} with Sift.
12+
13+
## Decide based on risk score
14+
15+
Based on the login context data sent to Sift, it calculates a risk score, where a higher score indicates a higher likelihood of fraud.
16+
17+
You can configure {{product_name}} to deny or step up authentication when the risk score of a login request exceeds a defined threshold.
18+
19+
![Sift use case 1]({{base_path}}/assets/img/connectors/sift/sift-use-case-1.png){: width="600px"}
20+
21+
How it works,
22+
23+
- When a user attempts to log in, {{product_name}} sends the relevant contextual data such as IP address, device details, geolocation, to Sift.
24+
25+
- Sift analyzes these attributes along with its own data and calculates a risk score.
26+
27+
- Sift returns this value to {{product_name}}.
28+
29+
- Based on the configured threshold, {{product_name}} executes a predefined action:
30+
- Allow login if the score is within acceptable limits.
31+
- Deny login or enforce additional MFA if the score exceeds the threshold.
32+
33+
## Decide based on decision ID
34+
35+
You can use [Sift workflows](https://developers.sift.com/tutorials/workflows){: target="_blank"} to define decisions based on risk factors including the risk score.
36+
37+
Based on the login context data sent to Sift, it returns a decision ID instead of the raw risk score. This decision ID corresponds to a predefined action in the Sift console, such as `allow`, `deny`, or `challenge`.
38+
39+
By using decision IDs, organizations can offload complex risk logic to Sift, keeping {{product_name}} policies cleaner and more maintainable. This approach also allows real-time policy adjustments in the Sift console without redeploying configurations in {{product_name}}.
40+
41+
![Sift use case 2]({{base_path}}/assets/img/connectors/sift/sift-use-case-2.png){: width="600px"}
42+
43+
How it works,
44+
45+
- When a user attempts to log in, {{product_name}} sends the relevant contextual data such as IP address, device details, geolocation, to Sift.
46+
- Sift analyzes these attributes along with its own data and returns a decision ID to {{product_name}}.
47+
- Based on the decision ID received, {{product_name}} executes the corresponding action:
48+
- Allow login if the decision is `allow`.
49+
- Deny login if the decision is `deny`.
50+
- Enforce additional MFA if the decision is `challenge`.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Reference: Sift functions and parameters
2+
3+
This reference describes the functions and parameters you can use in [conditional authentication]({{base_path}}/guides/authentication/conditional-auth/) scripts to interact with Sift.
4+
5+
!!! note
6+
- To use these functions, you must first [set up Sift]({{base_path}}/guides/connectors/sift/set-up/) in {{product_name}}.
7+
- You can find example scripts in the [how to use Sift]({{base_path}}/guides/connectors/sift/how-to-use/) guide.
8+
9+
## `getSiftRiskScoreForLogin()`
10+
11+
This function,
12+
13+
- returns a value between 0 and 1. Higher the score, greater the risk.
14+
- returns –1 if an error occurs due to an invalid API key, network issue or a Sift server issue.
15+
- takes the following arguments.
16+
- `AuthenticationContext` - Current authentication [context]({{base_path}}/references/conditional-auth/api-reference/#context).
17+
- `LoginStatus` - Status of login; *LOGIN_SUCCESS* for a success status, *LOGIN_FAILED* for a failed status.
18+
- `AdditionalParameters` - Any extra parameters you want to send to Sift as explained in [additional parameters](#additional-parameters).
19+
20+
## `getSiftWorkflowDecision()`
21+
22+
This function,
23+
24+
- returns the Sift decision ID for a login event. This ID uniquely identifies the decision made during the Sift workflow for that event. Learn more about [Sift workflows](https://developers.sift.com/tutorials/workflows){: target="_blank"}.
25+
- returns null if an error occurs due to an invalid API key, network issue or a Sift server issue.
26+
- takes the following arguments.
27+
- `AuthenticationContext` - Current authentication [context]({{base_path}}/references/conditional-auth/api-reference/#context).
28+
- `LoginStatus` - Status of login; *LOGIN_SUCCESS* for a success status, *LOGIN_FAILED* for a failed status.
29+
- `AdditionalParameters` - Any extra parameters you want to send to Sift as explained in [additional parameters](#additional-parameters).
30+
31+
## `publishLoginEventToSift()`
32+
33+
This function,
34+
35+
- publishes the status of the current login event to Sift, indicating whether it succeeded or failed.
36+
- takes the following arguments.
37+
- `AuthenticationContext` - Current authentication [context]({{base_path}}/references/conditional-auth/api-reference/#context).
38+
- `LoginStatus` - Status of login; *LOGIN_SUCCESS* for a success status, *LOGIN_FAILED* for a failed status.
39+
- `AdditionalParameters` - Any extra parameters you want to send to Sift as explained in [additional parameters](#additional-parameters).
40+
41+
## Additional parameters
42+
43+
You can configure the following options when creating a conditional authentication script using Sift-related functions.
44+
45+
### Customize the data sent to Sift
46+
47+
To assess risk of a login event, {{product_name}} sends the following data to Sift:
48+
49+
- user ID (mandatory)
50+
- session ID
51+
- IP address
52+
- user agent
53+
54+
You can override the default values that {{product_name}} sends by passing these as additional parameters in the functions. You can also exclude any optional parameter from being sent, by setting the value to an empty string as shown below.
55+
56+
```javascript
57+
var additionalParams = {
58+
"$ip": "",
59+
"$user_agent": "",
60+
"$session_id": ""
61+
}
62+
```
63+
64+
!!! important
65+
The `$user_id` field sent to Sift is **not** the user's actual UUID. By default, it contains a hashed value of the username. To reliably identify users in Sift, use the `user_uuid` field, which is published separately in the event payload and contains the actual user UUID.
66+
67+
### User data published to Sift
68+
69+
The following user attributes may be included in the event payload depending on your [fraud detection configuration]({{base_path}}/connectors/sift/set-up/#step-3-configure-fraud-detection-settings).
70+
71+
#### User information
72+
73+
| Field | Description |
74+
|---|---|
75+
| **Email** | The user's registered email address. |
76+
| **Mobile** | The user's mobile phone number. Published only if in E.164 format. |
77+
| **Name** | The user's full name. If unavailable, the first or last name is used instead. |
78+
79+
#### User browser and device metadata
80+
81+
| Field | Description |
82+
|---|---|
83+
| **IP Address** | The user's IP address at the time of the event. |
84+
| **User Agent** | The browser or device user agent string associated with the user's session. |
85+
86+
### Enable logging
87+
88+
You can enable logging by sending `"loggingEnabled": true` as an additional parameter in the functions.
89+
90+
- If sent with `getSiftRiskScoreForLogin()`, it logs the payload sent to Sift and the risk score that Sift returns.
91+
- If sent with `getSiftWorkflowDecision()`, it logs the payload sent to Sift and the decision ID returned by Sift.
92+
- If sent with `publishLoginEventToSift()`, it logs the payload sent to Sift.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Set up
2+
3+
The following guide explains how you can install and set up Sift in {{product_name}}.
4+
5+
## Prerequisites
6+
7+
You need to have a Sift account. If you don't have an account, create one by visiting the [Sift website](https://sift.com/).
8+
9+
## Step 1: Install the Sift connector
10+
11+
Follow the steps below to install Sift in {{product_name}}.
12+
13+
1. Download the following artifacts from the {{product_name}} [connector store](https://store.wso2.com/connector/identity-fraud-detection-sift){: target="_blank"}.
14+
- `org.wso2.carbon.identity.fraud.detection.sift-<version>.jar` - The Sift connector jar file.
15+
- `sift-java-<version>.jar` - The Sift Java SDK jar file.
16+
2. Copy the `org.wso2.carbon.identity.fraud.detection.sift-<version>.jar` file to the `<IS_HOME>/repository/components/dropins` directory.
17+
3. Copy the `sift-java-<version>.jar` file to the `<IS_HOME>/repository/components/lib` directory.
18+
4. Restart {{product_name}}.
19+
20+
## Step 2: Add the API key
21+
22+
To work with Sift, you need to register your Sift API key in {{product_name}}. To do so,
23+
24+
1. On the {{product_name}} Console, go to **Login & Registration**.
25+
2. Click **Sift Configuratioin** and enter the API key.
26+
![Configuring Sift in WSO2 Console]({{base_path}}/assets/img/connectors/sift/sift-configs.png)
27+
3. Click **Update** to save the changes.
28+
29+
## Step 3: Configure fraud detection settings
30+
31+
After adding the API key, you can further configure how {{product_name}} interacts with Sift.
32+
33+
### Information to include in the event payload
34+
35+
- Enable **Include user profile information in the event payload** to include the user's `email`, `mobile`, and `name` in events sent to Sift.
36+
- Enable **Include user device metadata in the event payload** to include the user's `IP address` and `User Agent` in events sent to Sift.
37+
38+
### Events to publish
39+
40+
You can select which user events are published to Sift for fraud analysis:
41+
42+
| Event | Description |
43+
|---|---|
44+
| **Registrations** | Publishes user registration events. |
45+
| **Credential Updates** | Publishes user credential update events. |
46+
| **User Profile Updates** | Publishes user profile update events. |
47+
| **Logins** | Publishes user login events. |
48+
| **Logouts** | Publishes user logout events. |
49+
| **User Verifications** | Publishes notification-based user verification events. |
50+
51+
!!! note
52+
User self-registration and password reset related Sift events are only published when using the legacy self-registration and password recovery flows.
53+
54+
### Diagnostic logging
55+
56+
Enable **Log event payloads locally** to log the event payloads sent to Sift as diagnostic logs in {{product_name}}. This is useful for troubleshooting your Sift integration.
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Usage
2+
3+
Administrators can use the risk score or decision ID returned by Sift to decide whether to allow, deny, or step up authentication for a login attempt.
4+
5+
{{product_name}} supports two mechanisms for Sift fraud detection:
6+
7+
- **Event Publishing** — Passively publishes user events such as registrations, logins, logouts, credential updates, profile updates, and user verifications to Sift. Once configured, events are published automatically with no additional steps required. This is useful for events outside the login flow that conditional authentication cannot cover.
8+
- **Conditional Authentication** — Actively queries Sift during login and makes real-time authentication decisions based on the risk score or decision ID returned by Sift.
9+
10+
This guide gives examples of how to use the Sift functions in [conditional authentication]({{base_path}}/guides/authentication/conditional-auth/) scripts to customize the login flow based on risk.
11+
12+
## Prerequisites
13+
14+
- If you haven't already, [register your application]({{base_path}}/guides/applications/#register-an-application) in {{product_name}}.
15+
16+
- [Set up conditional authentication]({{base_path}}/guides/authentication/conditional-auth/configure-conditional-auth/) for your application.
17+
18+
!!! note
19+
20+
Learn more about all the elements you can use to create conditional authentication scripts in its [API reference]({{base_path}}/references/conditional-auth/api-reference/).
21+
22+
## Risk score-based scenario
23+
24+
In this example scenario, imagine you want to fulfill the following requirements:
25+
26+
- if the user's risk score exceeds 0.7, fail the login attempt.
27+
28+
- if the risk score falls between 0.5 and 0.7, prompt for an extra login step.
29+
30+
- if authentication fails, publish a login fail event to Sift.
31+
32+
- Enable {{product_name}} to send the user ID, session ID, IP address to Sift for risk evaluation, but prevent sending the user agent information to Sift.
33+
34+
You can implement this using the [getSiftRiskScoreForLogin()]({{base_path}}/connectors/sift/reference/#getsiftriskscoreforlogin) function in a conditional authentication script as shown below.
35+
36+
```javascript
37+
var additionalParams = {
38+
"loggingEnabled": true, // enable logging for debugging
39+
"$user_agent": "" // prevent sending user agent info to Sift
40+
}
41+
var errorPage = '';
42+
var suspiciousLoginError = {
43+
'status': 'Login Restricted',
44+
'statusMsg': 'You login attempt was identified as suspicious.'
45+
};
46+
47+
var onLoginRequest = function (context) {
48+
executeStep(1, {
49+
onSuccess: function (context) {
50+
var riskScore = getSiftRiskScoreForLogin(context, "LOGIN_SUCCESS", additionalParams);
51+
if (riskScore == -1) {
52+
Log.info("Error occured while obtaining Sift score.");
53+
}
54+
if (riskScore > 0.7) {
55+
sendError(errorPage, suspiciousLoginError);
56+
} else if (riskScore > 0.5) {
57+
executeStep(2);
58+
}
59+
},
60+
onFail: function (context) {
61+
publishLoginEventToSift(context, 'LOGIN_FAILED', additionalParams);
62+
}
63+
});
64+
};
65+
```
66+
67+
How it works:
68+
69+
- When a user attempts to log in, the script executes step 1 (e.g., username/password authentication).
70+
71+
- If step 1 is successful, it calls the `getSiftRiskScoreForLogin()` function, passing the current authentication context, login status, and additional parameters. This function sends the relevant contextual data to Sift and retrieves the risk score.
72+
73+
- Based on the returned risk score:
74+
75+
- If the score is greater than 0.7, it sends an error response, effectively blocking the login attempt.
76+
77+
- If the score is between 0.5 and 0.7, it executes step 2 (e.g., an additional authentication step like OTP).
78+
79+
- If step 1 fails, it calls the `publishLoginEventToSift()` function to notify Sift of the failed login attempt, which can help improve future risk assessments.
80+
81+
- Additional parameters enable logging and prevent {{product_name}} from sending the user agent information to Sift.
82+
83+
## Decision ID-based scenario
84+
85+
In this example scenario, imagine you want to fulfill the following requirements:
86+
87+
- if the decision ID is `session_looks_bad_account_takeover`, fail the login attempt.
88+
89+
- if the decision ID is `mfa_account_takeover`, prompt for an extra login step.
90+
91+
- if the login fails, publish a login fail event to Sift.
92+
93+
- Enable {{product_name}} to send the user ID, session ID, IP address to Sift for risk evaluation, but prevent sending the user agent information to Sift.
94+
95+
You can implement this using the [getSiftWorkflowDecision()]({{base_path}}/connectors/sift/reference/#getsiftworkflowdecision) function in a conditional authentication script as shown below.
96+
97+
```javascript
98+
var additionalParams = {
99+
"loggingEnabled": true, // enable logging for debugging
100+
"$user_agent": "", // prevent sending user agent info to Sift
101+
}
102+
var errorPage = '';
103+
var suspiciousLoginError = {
104+
'status': 'Login Restricted',
105+
'statusMsg': 'You login attempt was identified as suspicious.'
106+
};
107+
108+
var onLoginRequest = function (context) {
109+
executeStep(1, {
110+
onSuccess: function (context) {
111+
var workflowDecision = getSiftWorkflowDecision(context, "LOGIN_SUCCESS", additionalParams);
112+
if (workflowDecision == null) {
113+
Log.info("Error occured while obtaining Sift score.");
114+
}
115+
if (workflowDecision == "session_looks_bad_account_takeover") {
116+
sendError(errorPage, suspiciousLoginError);
117+
} else if (workflowDecision == "mfa_account_takeover") {
118+
executeStep(2);
119+
}
120+
},
121+
onFail: function (context) {
122+
publishLoginEventToSift(context, 'LOGIN_FAILED', additionalParams);
123+
}
124+
});
125+
};
126+
```
127+
128+
How it works:
129+
130+
- When a user attempts to log in, the script executes step 1 (e.g., username/password authentication).
131+
132+
- If step 1 is successful, it calls the `getSiftWorkflowDecision()` function, passing the current authentication context, login status, and additional parameters. This function sends the relevant contextual data to Sift and retrieves the decision ID.
133+
134+
- Based on the returned decision ID:
135+
136+
- If the decision ID is `session_looks_bad_account_takeover`, it sends an error response, effectively blocking the login attempt.
137+
138+
- If the decision ID is `mfa_account_takeover`, it executes step 2 (e.g., an additional authentication step like OTP).
139+
140+
- If step 1 fails, it calls the `publishLoginEventToSift()` function to notify Sift of the failed login attempt, which can help improve future risk assessments.
141+
142+
- Additional parameters enable logging and prevent {{product_name}} from sending the user agent information to Sift.

0 commit comments

Comments
 (0)