This guide explains how to use your SAML identity provider (IdP) to assign a Coconut profile and Custom Roles when a user signs in. Before you begin, ensure that basic SSO and SSO role mapping are already configured
- Before you begin
- How it works
- Set up Coconut
- Configure your identity provider
- Test before production rollout
- Expected behaviour
- Troubleshooting
Before you begin
- Your Coconut SAML SSO connection must already be working.
- Your Coconut administrator must have created the Custom Roles you want to assign through SSO.
- Have a test user available in your IdP.
- Coordinate with your Coconut contact to confirm that SSO role provisioning is enabled for your organization.
How it works
Coconut reads a SAML attribute named externalRoleId at sign-in.
The attribute must contain two or more values in this order:
- Your Coconut profile mapping value
- One or more Custom Role IDs
Note:
The first value must be your Coconut profile mapping value, and any subsequent values in the attribute are Custom Role IDs. Each Custom Role ID must be in its own value within the externalRoleId attribute.
For example:
profile-branch-manager
crp-analytics
crp-approver
Important:
- Values are case-sensitive.
- The first value always selects the user’s Coconut profile. Do not place a Custom Role ID first.
- Every additional value must exactly match the External ID of an active Custom Role in Coconut.
- Send separate SAML attribute values, not one comma-separated value. For example,
profile-branch-manager, crp-analyticsis not valid
Conceptually, the SAML assertion should look like this:
<Attribute Name="externalRoleId">
<AttributeValue>profile-branch-manager</AttributeValue>
<AttributeValue>crp-analytics</AttributeValue>
<AttributeValue>crp-approver</AttributeValue>
</Attribute>
Set up Coconut
- In Coconut SSO settings, create or confirm the User Role Mapping for the profile value you will send first (for example,
profile-branch-manager). - In each Custom Role you want to assign through SSO, set the role’s External ID to the exact value your IdP will send (for example,
crp-analytics). - Record the ordered values for your test user.
Configure your identity provider
In your external identity provider, navigate to your Coconut SAML application, and add or update the attribute named externalRoleId.
Configure it to send repeated, ordered values:
- First: the Coconut profile mapping value
- Then: the applicable Custom Role External IDs
The exact steps vary by provider. Use your provider’s current documentation, then validate the actual SAML assertion before rolling out the change.
Microsoft Entra ID
- Open the Coconut enterprise application.
- Go to Single sign-on → Attributes & Claims.
- Add or edit the
externalRoleIdclaim. - Use a multi-valued source attribute or transformation as appropriate.
- Ensure the profile mapping value is emitted first, followed by Custom Role IDs.
Okta
- Open the Coconut SAML application.
- Go to Sign On → Attribute Statements.
- Add an attribute named
externalRoleId. - Configure the profile attribute or expression to return multiple values in the required order.
Google Workspace
- Create a multi-value custom user attribute named
externalRoleId. - For the test user, enter the values in the required order.
- In the Coconut SAML application, map that custom attribute to
externalRoleId.
Other SAML 2.0 providers
Your provider must be able to send multiple values for one SAML attribute, in a defined order. The required contract is the same:
- Attribute name:
externalRoleId - First value: Coconut profile mapping value
- Remaining values: Custom Role External IDs
- Format: repeated SAML values, not a delimited string
Test before production rollout
- Sign in to Coconut using the test user.
- Inspect the raw SAML response. Confirm there is one
externalRoleIdattribute with multiple values in the intended order. - Confirm the user receives the expected Coconut profile and Custom Roles.
- Remove one Custom Role ID from the IdP, sign in again, and confirm that role is removed.
- Test with only the profile value to confirm your standard profile-based role behavior.
A preview in your IdP’s expression editor is not sufficient. The raw SAML assertion is the source of truth.
Expected behaviour
- Coconut updates SSO-managed Custom Roles when the user next signs in through SSO.
- Adding a role value in the IdP adds that role at the next SSO login.
- Removing a role value in the IdP removes that role at the next SSO login.
- If any value is invalid, access is not partially assigned. Correct the mapping and try again.
- If SSO role provisioning is being used, updating a user’s role in the Coconut app UI will only apply for that user’s active Session, and will be reset to whatever Role(s) have been assigned in the IDP upon their next login
Troubleshooting
| Issue | What to check |
|---|---|
| Sign-in fails after adding roles | Confirm the attribute is named externalRoleId; the first value maps to a Coconut profile; later values exactly match active Custom Role External IDs; and the assertion contains separate values rather than a comma-separated string. |
| Profile is correct but Custom Roles are missing | Inspect the raw SAML response. Confirm all role IDs appear as additional externalRoleId values. |
| The wrong profile is assigned | Check the first externalRoleId value. It must be the profile mapping value, not a Custom Role ID. |
| A role remains after removal in the IdP | Have the user sign in again through SSO. Updates occur at the next SSO login. |
| You cannot find a separate provisioning page | There is no separate SSO role provisioning page. Configure profile mapping in SSO settings and Custom Role External IDs in the relevant Custom Role settings. |
| Assigned Roles get unassigned when a user logs in | Confirm the Role(s) were assigned via the IDP, and exist in the SAML for the user. Any Roles assigned in the UI will not last past user login if they do not have the correct entitlement or group that allows them to be assigned the Role through SSO provisioning |
What to provide when requesting support
When requesting support from our technical support team, please provide the following:
- Your organization name and environment
- Your identity provider
- The ordered
externalRoleIdvalues expected for the test user - The profile mapping value and Custom Role External IDs being used
- A redacted SAML assertion showing the
externalRoleIdattribute - The test user’s sign-in time and the observed result or error message
Do not include passwords, certificates, or other secrets.