> For the complete documentation index, see [llms.txt](https://docs.twosense.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.twosense.ai/identity-provider/pingfederate-integration.md).

# PingFederate Integration Guide

## Prerequisites

* PingFederate admin console access
* Twosense Endpoint Agent v3.12.0 or later
* Imprivata Agent (if using badge tap as a step-up)

## Understanding the Twosense IdP Flows

To support multiple different workstation types, our identity provider comes with two different flows:

* **Identity Flow**: When the user's identity is not known, you can use this flow to obtain it from the workstation and provide it to subsequent steps in your policy. It does not authenticate the user.
* **Auth Flow**: Once the user's identity is known (e.g., through Kerberos or an earlier Identity Flow step), you can use this flow to authenticate the user with Twosense or a configured step-up remediation, such as an Imprivata badge tap.

Which ones you use depend on your specific setup. If you're unsure, feel free to [contact us](mailto:support@twosense.ai) and we will be happy to help with the integration process.

## Enabling the Identity Provider

To enable Twosense identity provider access for your tenant, please [contact us](mailto:support@twosense.ai). Self-serve activation is not currently available.

### Allow Local Network Access

{% hint style="warning" %}
If you use other Chromium-based browsers (such as Microsoft Edge) in your organization, you will need to repeat these steps for those browsers.
{% endhint %}

The Twosense IdP uses local requests to communicate with the Twosense Endpoint Agent, and starting with Chrome version 142 this is automatically blocked unless explicitly allowed by the user or via Group Policy. In order to allow this behavior, you will need to add a policy exception.

Use the [`LocalNetworkAccessAllowedForUrls`](https://chromeenterprise.google/policies/#LocalNetworkAccessAllowedForUrls) policy to grant the Twosense IdP local network access. Add the following to the list of allowed URLs:

```
https://idp.twosense.ai/*
```

## Identity Flow Setup

The identity flow tells PingFederate which user is signed in to a shared workstation. It doesn't check whether the person should get access; that's the auth flow's job. You'll create one OpenID Connect IdP connection for it, using the identity client credentials from your Twosense representative.

Before you start, have these values from your Twosense representative ready:

* The identity flow's **Issuer** (for example, `https://idp.twosense.ai/acme-1234/identity`)
* The identity client's **Client ID** and **Client Secret**

### Create the Identity Connection

1. Navigate to **AUTHENTICATION** and select **IdP Connections**.
2. Click **Create Connection**.
3. In the **Connection Type** tab, check **Browser SSO Profiles**, set *Protocol* to **OpenID Connect**, and click **Next**.

   ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-cea222e0f9d610a41de271994bc6852600cb8f5f%2Fidp-pingfed-01-connection-type.png?alt=media)
4. In the **Connection Options** tab, leave **Browser SSO** checked and click **Next**.
5. In the **General Info** tab, set the following:

   * *Issuer*: **{Identity flow issuer}**
   * Click **Load Metadata**. This fills in the endpoints you'll see later in **Protocol Settings**.
   * *Connection Name*: **Twosense Identity** (or another descriptive name)
   * *Client ID*: **{Identity client ID}**
   * *Client Secret*: **{Identity client secret}**
   * Click **Next**.

   ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-7aa7f84a678d0c374dea88108d5aa0694ac4627a%2Fidp-pingfed-03-general-info.png?alt=media)
6. In the **Browser SSO** tab, click **Configure Browser SSO**.
7. In the **User-Session Creation** tab, click **Configure User-Session Creation**.
   1. In the **Identity Mapping** tab, select **No Mapping** and click **Next**. This connection is only used inside an authentication policy, so it doesn't create a session of its own.

      ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-b5b1b7d5c22e4dcc3d7696acbbd5776af44c9d0f%2Fidp-pingfed-06-identity-mapping.png?alt=media)
   2. In the **Attribute Contract** tab, add each of the following under **Extend the Contract**, clicking **Add** after each one, then click **Next**:

      * **acr**
      * **amr**
      * **twosense\_flow**
      * **upn**
      * **device\_hostname**
      * **imprivata\_assertion\_id**

      See [Identity Flow Attributes](#identity-flow-attributes) for what each one contains.

      ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-508b9ba5a593cf188ce3a008b3eacff7a331aadc%2Fidp-pingfed-07-attribute-contract.png?alt=media)
   3. In the **Summary** tab, click **Done**.
8. Back in the **User-Session Creation** tab, click **Next**.
9. In the **Protocol Settings** tab, click **Configure Protocol Settings**.
   1. In the **OpenID Provider Info** tab, confirm the following:

      * *Scopes*: **openid**
      * *Authorization Endpoint*, *Token Endpoint*, and *JWKS URL* are filled in. If **Load Metadata** didn't fill them, use `{issuer}/connect/authorize`, `{issuer}/connect/token`, and `{issuer}/.well-known/jwks`.
      * *OpenID Connect Login Type*: **Code**
      * *Authentication Scheme*: **Basic**
      * *Enable Proof Key for Code Exchange (PKCE)*: **checked**
      * *Request Parameters*: leave empty.
      * Click **Next**.

      ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-c8ea1e72d41e4a1b844762f6fc16381e807643c2%2Fidp-pingfed-08-protocol-settings.png?alt=media)
   2. In the **Overrides** tab, click **Next**.
   3. In the **Summary** tab, click **Done**.
10. Back in the **Protocol Settings** tab, click **Next**, then click **Done** in the **Summary** tab.
11. In the **Browser SSO** tab, click **Next**.
12. In the **Activation & Summary** tab:

    * Make sure the connection is enabled.
    * Copy the **Redirect URI** and send it to your Twosense representative, who will register it for the identity client.
    * Click **Save**.

    ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-29358ef1391121d9b5434bcfbc09753d18cd4252%2Fidp-pingfed-09-activation-summary.png?alt=media)

{% hint style="warning" %}
Don't add request parameters to this connection, and don't let the target application override any. Each Twosense client can only run its own flow, so no parameters are needed.
{% endhint %}

## Auth Flow Setup

The auth flow verifies that the person at the workstation is who PingFederate expects, using behavioral trust and, if needed, an Imprivata badge tap. It runs on every workstation type. You'll create a second OpenID Connect IdP connection for it, using the auth client credentials from your Twosense representative.

Before you start, have these values from your Twosense representative ready:

* The auth flow's **Issuer** (for example, `https://idp.twosense.ai/acme-1234/auth`)
* The auth client's **Client ID** and **Client Secret**

### Create the Auth Connection

Follow the steps in [Create the Identity Connection](#create-the-identity-connection), with these differences:

1. In the **General Info** tab, use the auth flow's issuer and the auth client's credentials, and set *Connection Name* to **Twosense Auth**.

   ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-af99cf191837a160963772e9e7deef7247bd6f46%2Fidp-pingfed-10-auth-general-info.png?alt=media)
2. In the **Attribute Contract** tab, add each of the following:

   * **acr**
   * **amr**
   * **twosense\_flow**
   * **upn**
   * **device\_hostname**
   * **twosense\_behavioral\_result**
   * **twosense\_stepup\_result**
   * **imprivata\_modality**
   * **imprivata\_tapped\_at**
   * **imprivata\_assertion\_id**

   See [Auth Flow Attributes](#auth-flow-attributes) for what each one contains.

   ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-fe14be02268d3fb4fbad0bef89e8c29607c2fbe7%2Fidp-pingfed-11-auth-attribute-contract.png?alt=media)
3. In the **OpenID Provider Info** tab, the endpoints use the auth issuer. Everything else is the same.

   ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-2b9567f916a7a8bcb2ba0ae3924b88a55759b60e%2Fidp-pingfed-12-auth-protocol-settings.png?alt=media)
4. In the **Activation & Summary** tab, copy this connection's **Redirect URI** and send it to your Twosense representative as well. Each connection has its own redirect URI, and each one is registered for its own client.

When you're done, both connections appear in the list:

![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-c0398002b62bb90bc5bda649c7e72616ef4b8040%2Fidp-pingfed-14-idp-connections-list.png?alt=media)

## Using Twosense in a Policy

How you use the two connections depends on the workstation type:

* **Shared (Type 2) workstations** run the identity connection first to determine which user is signed in, then the auth connection to verify them.
* **Personal (Type 1) workstations** already know who is signed in through Kerberos, so only the auth connection runs.

In both cases, the auth connection needs to know who it's verifying. PingFederate passes that user to Twosense through the auth node's **Incoming User ID**, and Twosense checks it against the person currently signed in at the workstation. The value must be the user's **Active Directory SID** (for example, `S-1-5-21-…`).

{% hint style="info" %}
Always map your policy contract from **Twosense Auth**, never directly from **Twosense Identity**. The identity result identifies the user but doesn't verify them.
{% endhint %}

### Shared Workstations

1. Navigate to **AUTHENTICATION** and select **Policies**.
2. Click **Add Policy**, or open the policy your shared workstations already use.
3. Set **Name** to **Shared Workstations (Twosense)** or another descriptive name.
4. Under **Policy**, select **IdP Connections** → **Twosense Identity**. If your policy starts with a selector (for example, one that matches your shared-workstation service accounts), put the identity connection on that selector's matching branch instead.
5. Under the identity connection's **Fail**, choose what happens when Twosense can't identify the user. At this point nobody has been identified, so the fallback has to start by asking for a username, for example a login form.
6. Under the identity connection's **Success**, select **IdP Connections** → **Twosense Auth**.
7. Under **Twosense Auth**, click **Options**. Set *Source* to **IdP Connection (Twosense Identity)** and *Attribute* to **sub**, then click **Done**.

   ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-9a47d63e2eb7055eb908bf9a92f3db25e4c60e66%2Fidp-pingfed-16-incoming-user-id.png?alt=media)
8. Under the auth connection's **Success**, select your policy contract, then click **Contract Mapping**.
   1. In the **Attribute Sources & User Lookup** tab, click **Next**.
   2. In the **Contract Fulfillment** tab, map your contract's attributes from **IdP Connection (Twosense Auth)**. For example, map *subject* to **sub**, *acr* to **acr**, *amr* to **amr**, and *upn* to **upn**. Click **Next**.

      ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-193cc88948e9ba80e63a882d37a21d0d90f22a6c%2Fidp-pingfed-17-contract-fulfillment.png?alt=media)
   3. In the **Issuance Criteria** tab, click **Next**.
   4. In the **Summary** tab, click **Done**.
9. Under the auth connection's **Fail**, add your fallback. For example, to fall back to Duo:
   1. Select **IdP Adapters** → your Duo adapter.
   2. Click **Options** on the Duo node. Set *Source* to **IdP Connection (Twosense Identity)** and *Attribute* to **upn** (or whichever value matches your Duo usernames), then click **Done**.

      ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-7d1d7c8e4e6c118e09210d7e014642856642f155%2Fidp-pingfed-18-duo-incoming-user-id.png?alt=media)
   3. Under Duo's **Success**, select your policy contract and map it from **IdP Connection (Twosense Identity)**, since the auth step didn't succeed.

      ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-3fd5c1c626545aff0fc85345ea4db49a1af6ebfc%2Fidp-pingfed-19-duo-contract-fulfillment.png?alt=media)
   4. Under Duo's **Fail**, select **Done**.
10. Click **Done**, then click **Save** on the **Policies** page.

The finished policy looks like this:

![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-5ba4301cb10802407370ea7ea6d293e7f4340c20%2Fidp-pingfed-15-policy-tree.png?alt=media)

### Personal Workstations

This example uses a Kerberos adapter as the first step.

1. Navigate to **AUTHENTICATION** and select **Policies**, then click **Add Policy** or open your existing policy.
2. Under **Policy**, select **IdP Adapters** → your Kerberos adapter.
3. Under Kerberos's **Fail**, keep your existing login behavior.
4. Under Kerberos's **Success**, select **IdP Connections** → **Twosense Auth**.
5. Under **Twosense Auth**, click **Options**. Set *Source* to **Adapter (Kerberos)** and *Attribute* to **ObjectSID**, then click **Done**.

   ![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-86c5dd7e357f1cb371115e6eff7c5ebc46622eca%2Fidp-pingfed-21-type1-incoming-user-id.png?alt=media)
6. Under the auth connection's **Success**, map your policy contract from **IdP Connection (Twosense Auth)**, as in [Shared Workstations](#shared-workstations).
7. Under the auth connection's **Fail**, add your fallback. For Duo, set the Duo node's Incoming User ID to **Adapter (Kerberos)** → **Username**, and map the contract's *subject* from **Adapter (Kerberos)** → **ObjectSID**.
8. Click **Done**, then click **Save** on the **Policies** page.

The finished policy looks like this:

![](https://2506335720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4TqRts23ezLkhgSKp2RB%2Fuploads%2Fgit-blob-98cbcbcb09e8ad1f53fd7531f2215fb970da2534%2Fidp-pingfed-20-type1-policy-tree.png?alt=media)

## Attribute Reference

Each flow returns its attributes in the ID token. These are the attributes you add to each connection's attribute contract, plus `sub`, which PingFederate includes by default.

### Identity Flow Attributes

| Attribute                | Description                                                                                                                                                                                              | Example                                          |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| `sub`                    | The user's Active Directory SID, taken from the signed Imprivata assertion. Pass this to the auth connection as its Incoming User ID.                                                                    | `S-1-5-21-1004336348-1177238915-682003330-51294` |
| `acr`                    | Always `urn:twosense:user-identity`. It shows the user was identified, not verified.                                                                                                                     | `urn:twosense:user-identity`                     |
| `amr`                    | How the user started their Imprivata session, with one value per factor: `pwd` for a password and `urn:twosense:imprivata-badge` for a badge tap. Any other Imprivata method is reported as `undefined`. | `["urn:twosense:imprivata-badge"]`               |
| `twosense_flow`          | The flow that produced the token.                                                                                                                                                                        | `user-identity`                                  |
| `upn`                    | The user's UPN, in lowercase.                                                                                                                                                                            | `jsmith@acme.com`                                |
| `device_hostname`        | The Windows computer name of the workstation.                                                                                                                                                            | `ACME-WS-1042`                                   |
| `imprivata_assertion_id` | The ID of the Imprivata assertion that identified the user. Use it to find the matching entry in Imprivata's audit log.                                                                                  | `_2df2522868a8ecdbfa711b82c223c994`              |

### Auth Flow Attributes

The auth flow only returns a token when the user is verified. If Twosense denies the login, PingFederate receives an error instead and follows the auth node's **Fail** branch.

| Attribute                    | Description                                                                                                                                                                              | Example                                                       |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| `sub`                        | The user's Active Directory SID. It always matches the Incoming User ID that PingFederate sent.                                                                                          | `S-1-5-21-1004336348-1177238915-682003330-51294`              |
| `acr`                        | How the user was verified: `urn:twosense:verified` when the behavioral check passed, or `urn:twosense:verified-stepup` when the user passed a step-up after the behavioral check failed. | `urn:twosense:verified`                                       |
| `amr`                        | The methods used in this login: `urn:twosense:behavioral`, plus `urn:twosense:imprivata-badge` if the user tapped their badge for a step-up.                                             | `["urn:twosense:behavioral", "urn:twosense:imprivata-badge"]` |
| `twosense_flow`              | The flow that produced the token.                                                                                                                                                        | `user-auth`                                                   |
| `upn`                        | The user's UPN, in lowercase.                                                                                                                                                            | `jsmith@acme.com`                                             |
| `device_hostname`            | The Windows computer name of the workstation.                                                                                                                                            | `ACME-WS-1042`                                                |
| `twosense_behavioral_result` | The result of the behavioral check. It's reported even when a step-up later succeeded.                                                                                                   | `allow` or `deny`                                             |
| `twosense_stepup_result`     | The result of the step-up. `not-required` means the behavioral check passed and no step-up was needed.                                                                                   | `allow` or `not-required`                                     |
| `imprivata_modality`         | The Imprivata method used for the step-up. Only present after a step-up.                                                                                                                 | `prox_card`                                                   |
| `imprivata_tapped_at`        | When the step-up happened, from the Imprivata assertion. Only present after a step-up.                                                                                                   | `2026-09-15T22:41:58Z`                                        |
| `imprivata_assertion_id`     | The ID of the Imprivata assertion for the step-up. Use it to find the matching entry in Imprivata's audit log. Only present after a step-up.                                             | `_7c41e9a05b3d48f2a61e0d9b8c27f513`                           |
