> ## Documentation Index
> Fetch the complete documentation index at: https://developers.resistant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Roles from your identity provider

> Send Web UI roles from your identity provider with the documents_roles attribute, and switch between IdP-managed roles and roles managed in Resistant Documents.

With SSO, your identity provider (IdP) can also decide each user's roles. It sends them with every sign-in in an attribute called `documents_roles`. Admins in the Web UI can then view users but can't change roles.

> [!NOTE]
>
> This page applies only if you want roles to come from your IdP. If you'd rather have your Admins assign roles in the Web UI, don't send `documents_roles`. Your SSO setup is complete without it. See [Sign-in and roles](https://developers.resistant.ai/view-results/web-ui/authentication-options.md).

## `documents_roles` format

`documents_roles` is a list of strings. Each value combines a Resistant AI tenant ID and a role code:

| Value | Role in that tenant |
| - | - |
| `<tenant_id>_RO` | **Viewer**: view analysis results (read-only) |
| `<tenant_id>_RW` | **Analyst**: upload documents and view results |
| `<tenant_id>_ADMIN` | **Admin**: Analyst permissions plus User management (view only) |

A user can have different roles across multiple tenants:

```json theme={null}
{
  "documents_roles": ["tenant1_RO", "tenant2_RW", "tenant3_ADMIN"]
}
```

> [!WARNING]
>
> Use the tenant IDs Resistant AI gives you, not your own identifiers.

### Sending it over SAML 2.0

Send `documents_roles` as a **multi-valued attribute**: the same attribute name, one value per role.

### Sending it over OIDC

Include `documents_roles` as an array claim in the ID token and/or the UserInfo response.

## Microsoft Entra ID: roles from security groups

[Microsoft Entra ID](https://developers.resistant.ai/view-results/web-ui/sso-entra-id.md) can send `documents_roles` either as fixed values or built from group membership. With a Microsoft Entra ID P1 license or higher, use **App roles** to turn security group membership into `documents_roles` values:

**1. Create an app role for each tenant role**

In **App Registration → App roles**, create one app role per value, for example:

* Display name: `ResistantAI_Read-Only_Role`
* Value (emitted in the claim): `3BiP9sxUXfmhsuvKZtEPqD69e2F_RO`
* Allowed member types: `Users/Groups`

**2. Assign security groups to app roles**

In **Enterprise App → Users and groups**, assign each security group to its app role, for example:

* `Auditors` → `ResistantAI_Read-Only_Role`
* `Fraud-Team` → `ResistantAI_Read-Write_Role`

**3. Add the documents\_roles claim**

In **Enterprise App → Single sign-on → Attributes & Claims → Add claim**:

* Claim name: `documents_roles`
* Type: `SAML`
* Value: `Multiple Conditional`
  * User type: members
  * Scoped groups: your user group (can be a dynamic group combining several groups)
  * Source: `Attribute`
  * Value: `user.assignedroles`

## Managing users when roles come from your IdP

All changes happen in your IdP:

* **Give someone access:** assign them to the Resistant Documents SAML/OIDC application and add a `documents_roles` value.
* **Change a role:** change their `documents_roles` value.
* **Remove access:** unassign them from the application or remove the value.

Changes take effect the next time the user signs in.

> [!WARNING]
>
> Your IdP must send `documents_roles` with every SAML assertion or OIDC token. If a user's sign-in arrives without a value for a tenant, they have no role in that tenant.

In the Web UI, Admins can see who has access in [User management](https://developers.resistant.ai/view-results/web-ui/user-management.md), but they can't invite users, change roles or remove users.

## Switching where roles are managed

The role setup applies to your whole organization. It follows from what your IdP sends:

* **From your IdP to Resistant Documents:** stop sending `documents_roles`. Every user keeps the role they had, Admins included. From then on, Admins manage roles in [User management](https://developers.resistant.ai/view-results/web-ui/user-management.md).
* **From Resistant Documents to your IdP:** start sending `documents_roles`. Roles then come from your IdP, and Admins can only view users.

> [!TIP]
>
> Let Resistant AI Support know before you switch, especially if you're moving to IdP roles, so we can help check the values you plan to send.

## Next steps

* [Sign-in and roles](https://developers.resistant.ai/view-results/web-ui/authentication-options.md): compare setups
* [User management](https://developers.resistant.ai/view-results/web-ui/user-management.md): what Admins can do


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.