# SAML

## Introduction

Simplify and centralize your user authentication process by integrating SAML into your Form.io project. This integration allows you to configure your application login forms to support SAML SSO authentication for your application users.

**SAML Provider**

Choosing a SAML provider is the first step in the integration process. A SAML application will then be created and configured. Form.io offers integration with many providers, including the following:

* [**OneLogin**](#onelogin)
* [**Okta**](#okta)
* [**Microsoft Entra ID**](#microsoft-entra-id) (formerly Azure AD)&#x20;
* [**Auth0**](#autho)

***

[**Passport Configuration**](#saml-passport-config)

Once a provider has been chosen and a SAML application has been created, the next step is to integrate the SAML application with your Form.io project. The integration process involves transferring specific credentials and endpoints from the SAML application and then using that information to construct a Passport Configuration  JSON object that will be saved within the Form.io Project connected to your application.   Form.io utilizes the Node.js SAML Authentication library.&#x20;

{% hint style="info" %}
Form.io utilizes the Node.js SAML Authentication library. \
[**Click Here** ](https://github.com/node-saml/node-saml)for documentation and a full list of SAML Passport properties&#x20;
{% endhint %}

***

[**Form.io Authentication Configuration**](#form.io-authentication-configuration)

After applying the correct information from your SAML Provider to your Project's authorization settings, the Form.io authentication form embedded in your application will be configured to support SAML SSO authentication.&#x20;

***

[**Portal Base SSO with SAML** ](https://help.form.io/deployments/portal-base-project/portalsso#saml-sso)

The following documentation is centralized around applying SAML to a client-based application connected to the Form.io project. The same concepts detailed in this documentation can also be applied to the Form.io Portal Base project that controls your Developer Portal to allow Form.io users to utilize SAML SSO to authenticate into the Form.io environment.&#x20;

***

### Video Tutorial

The following video demonstrates the creation of a SAML application, integration with Form.io, and configuring the authentication form that will instigate the SAML authentication process for the client application. OneLogin serves as the SAML Provider in this video, however, the same principles can be applied to other Providers.

{% embed url="<https://www.loom.com/share/a79a7d5b09cb468283e095116105e6bc>" %}

## How does Form.io SAML Work

SAML authentication uses settings in the project to communicate with an external SAML identity provider (IdP) in order to authenticate the user into the Form.io environment. The project roles can be mapped to SAML roles via the SAML configuration in the project. When creating the login form, add custom JavaScript to trigger a service provider-initiated SAML authentication flow, that allows users to authenticate using the IdP. The IdP returns a JWT to the user. The following shows step-by-step on how this process works.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F3nfIymOQ7GQz5lCZ9rJD%2FSAML_Auth_callouts.png?alt=media&#x26;token=3aa500e6-db21-4cfd-a840-2602e6661a98" alt="" width="375"><figcaption></figcaption></figure>

1. The **User** navigates to {{baseUrl}}/{{projectAlias}}/saml/sso (Usually via a button on the form that calls `Formio.ssoInit('saml')`)
2. The **Form.io Server** processes the SAML configuration settings into a SAML request .XML document and encodes it into a redirect link to the **IdP Server** for authentication.\
   The redirect link looks something like the following:\\

   &#x20;{{Entry Point}}?SAMLRequest=   {{encoded xml document}}&   relayState={{your relay state}}

{% hint style="info" %}
The relayState is used to navigate the user back to the SP login page after IdP login and is automatically set to the URL of your SP login page. This can be modified via the relay option when creating the form.
{% endhint %}

3. The user is redirected to a login page provided by the **IdP Server** (if the SAML request was valid).
4. Upon successful login, the **IdP Server** sends the user to an HTML document containing JavaScript that makes a POST request containing the SAML response .XML document to the callback URL specified in the SAML configuration.\
   The callback URL should point to the assertion consumer service endpoint (ACS) and look something like the following:\
   {{baseurl}}/{{projectUrl}}/saml/acs
5. The browser (**User**) executes the JavaScript to make the POST to the ACS endpoint (as described above).
6. The ACS endpoint on the **Form.io Server** processes the SAML response .XML document, verifying that the document and assertions are valid using the certificate specified in the SAMLE configuration.\
   It then takes the assertions given by the SAML response XML and generates a Formio JWT token. The server then redirects the user to the relay URL, with the JWT added as a query parameter. It should look something like the following:   \
   {{relay}}?saml={{JWT}}
7. With the JWT from the query parameter, call `Formio.ssoInit('saml')` again to add the JWT to the browser's local storage.\
   The user isnow authenticated to access **Form.io Server** resources!

## General Troubleshooting

While the SAML provider configuration and settings fall outside of Form.io, here are some common errors and troubleshooting tips if your SAML authentication isn't functioning correctly.

### Required Config Parameters

The only required fields needed by node-saml are...

* Issuer - The unique identifier you give when sending saml requests
* Cert - Used to verify the saml response document and assertions in the saml response&#x20;

All other fields are based on the configuration you have set in your IdP. This can very widely depending on what IdP you are using. A couple of recommended config parameters are...

* Entry Point - The url of your IdPs login endpoint
* Callback Url - The url that the saml response is sent to
* Want Assertions Signed - Check this if you want to verify that your assertions are signed correctly.\
  Note: Make sure your IdP is signing assertions if you have this checked or an error will occur
* Want Authn Response Signed - Check this if you want the top level of your saml response document to be signed\
  Note: Make sure your IdP is signing the top level of your saml response xml or an errro will occur

### **Errors**

#### **Invalid Signature**

* **Cause**: The signature in the SAML response or assertion could not be verified, often due to mismatched certificates between the IdP and Form.io or an unsupported signature algorithm.
* **Solution**: Ensure that the public certificate used by the IdP matches the one configured in Form.io and that the IdP supported signature algorithm (preferably RSA-SHA256).
* Ensure the cert from the Idp matches the cert saved in the Form.io SAML settings  \
  \
  Form.io typically signs:

  * **SAML Assertions** (the payload that contains authentication and user details).
  * Optionally, **SAML Responses** (the overall message containing the assertion).

  If the SAML signature isn't validated correctly, you may need to check the certificate used in the IdP configuration and ensure the hashing algorithm is compatible (e.g., SHA-256).

#### **Audience URI mismatch**

* **Cause**: The Audience URI in the SAML response from the IdP does not match what Form.io expects.
* **Solution**: Verify that the **Audience URI** in the IdP settings matches the URL of your Form.io application. This typically looks like:

  ```arduino
  http://myapplicationdomain.com
  ```
* Ensure there are no typos, extra slashes, or case-sensitivity issues.

#### **SAML Assertion is not valid**

* **Cause**: The SAML assertion may have expired, the certificate used to sign the assertion could be invalid, or the assertion lacks the necessary conditions.
* **Solution**: Check the SAML assertion for correct timestamps and validity. Ensure that the IdP is signing the assertion properly and that Form.io can validate the signature.
* Ensure the 'Email Path' and 'Roles Path' in the Form.io SAML settings align with the email and group parameters provided by the IdP. Often, these parameters will be set to 'email' and 'groups.'

#### **Invalid RelayState**

* **Cause**: The RelayState parameter in the SAML request is either missing or invalid.
* **Solution**: Ensure that the RelayState parameter is properly set in the SAML authentication request, and that it is being passed correctly between the IdP and Form.io. This will often time be the hosted application domain.

#### **NameID or Groups not found in SAML Assertion**

* **Cause**: The SAML assertion does not contain the `NameID or groups` attribute, which is essential for identifying the user or user SAML group.
* **Solution**: Ensure the IdP is configured to include the `NameID or group` attribute in the SAML assertion, typically within the `<Subject>` element.

#### **Missing Attribute Statement**

* **Cause**: The SAML assertion is missing required attributes that Form.io expects (e.g., email, username, or custom attributes).
* **Solution**: Check the IdP configuration to ensure it is passing the required user attributes in the SAML assertion.

### How to Troubleshoot:

1. **Use a SAML Tracing Tool**: Browser extensions like **SAML Chrome Panel** or **SAML-tracer** (Firefox) can capture SAML requests and responses for analysis.
2. **Check Configuration**: Verify that both the IdP and Form.io configurations are aligned, particularly regarding the Audience URI, ACS URL, and signature settings.
3. **Review Logs**: Check the IdP and SP logs for more detailed error messages that might provide clues to what went wrong.
4. **Password Configuration -** Utilize the **Passport Config** over the **SAML Metadata** when configuring the SAML integration settings within the Form.io Project.&#x20;

These error messages are typically due to configuration mismatches or signing issues, and can usually be resolved by carefully reviewing the settings on both sides.&#x20;

## OneLogin&#x20;

This section covers the [**OneLogin Provider**](https://developers.onelogin.com/saml) SAML application setup process and integration with the Form.io Project.&#x20;

### **Create and Configure Application**

1. From your OneLogin Admin dashboard, create a new application by clicking the **Applications tab** and then the **Add App** button.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FbmY6cQdURiTpOCLwjaqk%2Faddapp.jpg?alt=media&#x26;token=a56e11f8-46ee-4044-87b9-b9b20661fec2" alt=""><figcaption></figcaption></figure>

2. Select the **SAML Custom Connector (Advanced)** for **SAML2.0** application

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJ6mMM7ymzQQBnTV7N6Us%2Fsamlconnector.jpg?alt=media&#x26;token=5199fe6e-47c0-4c9a-91ce-6388934422e0" alt=""><figcaption></figcaption></figure>

3. Give the Application a name and click the **Save** button with the default configurations

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fq5id7sMS36B8hc1dJl8D%2Fsaveapp.jpg?alt=media\&token=2a87dcaa-a560-43ae-82cd-ed618432a8fc)

4. Click the **Configuration** tab to set up the application details
   * Add the **RelayState** (optional) - Live endpoint of the hosted application\
     `https://app.yoursite.com`
   * Add the **Audience (EntityID)** - Live endpoint of the hosted application\
     `https://app.yoursite.com`
   * Add the **ACS (Consumer) URL Validator** - [ **Live Endpoint**](https://help.form.io/userguide/projects/project-ui#header) of the Form.io Project with form.io\\/saml\\/acs appended at the end of the URL. Backslash characters `\` should be added in front of all forward slash characters `/`\
     `https:\/\/myproject.domain\/abc123\/saml\/acs`
   * Add the **ACS (Consumer) URL** - [**Live Endpoint**](https://help.form.io/userguide/projects/project-ui#header) of the Form.io Project with form.io/saml/acs appended at the end of the URL.   \
     `https://myproject.domain.com/abc123/saml/acs`&#x20;

The configuration should look similar to the following:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FCcibmNzjOqxPdw5VF2PG%2Fsamlconfigdetails.jpg?alt=media&#x26;token=c684b5ed-d69f-4c48-a1e1-d89fa49742a5" alt=""><figcaption></figcaption></figure>

5. Within the Configuration tab, set the **SAML signature element** to the **Both** setting

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fgn6hqEeFuSrjNksz8dfa%2Fsignatureelement.jpg?alt=media&#x26;token=90041852-e411-4ba5-9ba2-1ab49507e8d8" alt=""><figcaption></figcaption></figure>

#### **Configuring Parameters**&#x20;

6. Click the **Parameters** tab and ensure the following parameter is set (this should be set by default) **NameID** **value** field is configured with the **Email** value
7. Click the **Paramter** Tab, click the **+** button to add a new Parameter
   * Set the Field Name to **groups** (case sensitive)
   * &#x20;Set the Value to **User Roles**&#x20;
   * Check the **Include in SAML assertion** flag
   * **Save** the Parameter&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fw9bVQAE8LvOnKV1Y8ekI%2Fnewparameters.jpg?alt=media&#x26;token=52e4405a-108a-4ac4-9237-c39cda9bb9f7" alt="" width="375"><figcaption></figcaption></figure>

8. The application should have two parameters set\
   **NameID Value** (created by default with the application) \
   **group** parameter created in the previous step
9. **Save** the application

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FtcLp3P5631BBmRXmlksq%2Fparamterlist.jpg?alt=media&#x26;token=00736c38-a543-474d-9978-1df0a04f707e" alt=""><figcaption></figcaption></figure>

### Create Users

With the application configured, create a user base within the OneLogin Admin dashboard. Users can then be assigned to a Role linked with the SAML Application, enabling mapping between SAML Groups and Form.io roles.

1. Within the OneLogin Admin dashboard, hover over the User tab and click **Users**
2. Click the **New User** button

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FvOfREx2Dw32gcyIVtbra%2Fusers.jpg?alt=media\&token=270fe923-546c-4fdb-812c-517b280d11eb)

3. Input the Information for the User and then click **Save User**
4. Click the **More Action** tab and set a **Password** for the User
5. Generate multiple users to assign them to different roles that will be created in the next step

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FtqLLfpUrTk68aU1uiN3L%2Fuserinformation.jpg?alt=media&#x26;token=37b26351-b30f-4324-a42c-f295d841fe82" alt=""><figcaption></figcaption></figure>

### Create & Assign Groups

With our Users in place, the next step is to create **Roles** the SAML Users will be assigned to.  This will allow us to establish mappings between SAML Roles (Groups) and Form.io roles.&#x20;

1. Within the OneLogin Admin dashboard, hover over the User tab and click **Roles**
2. Click the **New Role** button

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FEKk8Aq4XqrczfvuGzjxW%2Froles.jpg?alt=media\&token=f6017df1-ec8b-4c8b-b7d3-64d1eec07bd8)

3. Give the **Role** a name and select your  SAML Application the Role should be associated with
4. Click the **Save** role

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FCLPj7kiH8L9wQhzdv9Mx%2Fassignroles.jpg?alt=media\&token=defe7fb7-181a-48f3-8edc-a7f38f4b4685)

5. Within the **Roles** tab, click the **Role** that was just created and click the **Users** Tab
6. Using the search bar, search and select all Users that should be added to the Role and click **Check**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FZQShzD5c7wAeFMCnHnzU%2Faddusers.jpg?alt=media&#x26;token=e9db5c09-5d72-4928-92e3-941fa441262a" alt=""><figcaption></figcaption></figure>

7. Click the **Add To Role** button for each user
8. Click **Save** &#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FmN8p63xGp085GVDki5lX%2Faddtorole.jpg?alt=media&#x26;token=8987ccb6-de1c-42c2-8c8e-96ba53e76456" alt=""><figcaption></figcaption></figure>

#### **Assign Role To Application**

With the Roles established, the next step is to assign the Role to the SAML application

1. Hover over the **Application** tab and select Applications
2. Navigate to your **SAML Application**
3. Click the **Access** tab&#x20;
4. **Select** all of the **Roles** you wish to assign to the Application\
   Users assigned to the selected roles will be associated with the Application.
5. Click **Save**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FxJJ89UJchapgHmxvABFn%2Fassignrolestoapplication.jpg?alt=media&#x26;token=33588bcf-fe94-438d-adfd-4762c44b7a4c" alt=""><figcaption></figcaption></figure>

### Passport Configuration

Once the SAML application setup is finalized, XML data will be extracted from the application and utilized for building the Passport Configuration. This JSON configuration will be saved to the Form.io Project to complete the integration. &#x20;

{% hint style="info" %}
[**Click Here**](#saml-passport-config) for more information about SAML Passport Configurations
{% endhint %}

#### **Download XML File**

1. Navigate to the **OneLogin** application&#x20;
2. Click the **More Actions** tab and click the **SAML Metadata** button to download the XML info

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FlCUFxXQdDz6fpCZyGZbX%2FOneLoginXML.jpg?alt=media&#x26;token=601a536a-346a-483c-814c-e1ebdb86675a" alt=""><figcaption></figcaption></figure>

3. Store the XML information as it will be used to construct the **Passport Config**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F61USAvVLC4gPurmE1qM3%2Fxmldata.jpg?alt=media&#x26;token=95b95370-c347-4fc8-b73c-10afdcb4a4f5" alt=""><figcaption></figcaption></figure>

4. Construct the **Passport Config JSON** object. Search the XML file for the property titles within the example below and input the data accordingly.&#x20;
   * The **identityProviderUrl** and **entryPoint** endpoint can be found by searching the **SingleSignOnService**  HTTP-REDIRECT endpoint
   * The **logoutUrl** endpoint can be found by searching **SingleLogoutService**
   * The **cert** can be found by searching the **X509Certificate**
   * The **identifierFormat** can be found by searching **NameIDFormat**
   * The **audience** must match the **Audience (EntityID)** endpoint within the **Configuration** tab within your OneLogin SAML application.&#x20;
   * The **issuer** can be found by searching the **entityID**

{% hint style="info" %}
Quickly generate the JSON object by utilizing the [**SAML Passport Generator**](#saml-passport-generator) found within the SAML Settings of the Form.io Project.&#x20;
{% endhint %}

```
{"identityProviderUrl": "https://form-dev.onelogin.com/trust/saml2/http-redirect/sso/abc-123", 
"entryPoint": "https://form-dev.onelogin.com/trust/saml2/http-redirect/sso/abc-123", 
"logoutUrl": "https://form-dev.onelogin.com/trust/saml2/http-redirect/slo/abc-123", 
"cert": "abc123", 
"identifierFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", 
"audience": "https://app.yoursite.com", 
"issuer": "https://app.onelogin.com/saml/metadata/abc-123"}
```

### **Form.io Integration**

With the Passport Config JSON object constructed, the Form.io project can now be configured.

1. Within the Form.io Project, click **Settings** > **Authentication** > **SAML**
2. Click the **Authorization Settings** tab

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJJBfrCSU1b5gybWYA3Bl%2Fauthsettings.jpg?alt=media&#x26;token=91d11107-00c3-4e0f-a180-ddfd519f8835" alt=""><figcaption></figcaption></figure>

3. Scroll down and paste the **Passport Config** JSON from the previous step

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FgGOQ7CD9MP5ntz5H7AaZ%2Foneloginsamlpassport.jpg?alt=media&#x26;token=104a7f97-ce07-4246-a990-03d6e48c294b" alt="" width="563"><figcaption></figcaption></figure>

4. Click the **Configuration** tab and add the following to the **Email Path** setting field\
   `email`
5. Click the **Save Settings**

#### **Role Mapping**

In many cases, you may want to map the SAML Role associated with the SAML User to a Form.io Role. Apply the following configurations to configure the Role mappings.&#x20;

6. Within the Form.io SAML settings, click the Configuration tab and set the following to the **Role Path**\
   [`groups`](#user-content-fn-1)[^1]

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fs51hpPRWtqCxIH7T2QMN%2Frolespath.jpg?alt=media&#x26;token=4a5f0f93-10bf-4387-82c5-995783074e74" alt=""><figcaption></figcaption></figure>

7. Within your OneLogin **SAML Application,** click the **Access** tab and take note of the **Role** **Names** assigned to the application.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FHqHY7926G4KehYRAL0NN%2Faccessroles.jpg?alt=media&#x26;token=2ab3ea7c-8da5-4cfe-98a4-bb3ca5713a05" alt=""><figcaption></figcaption></figure>

8. Back to the Form.io SAML settings, scroll down to the **Role Mapping** setting
9. Map **SAML** **Roles** (case sensitive) to the desired **Form.io Roles**
10. **Save** your settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FsVNcV0VckoMezsSy3QSB%2Frolemappings.jpg?alt=media&#x26;token=f3d2b8da-1086-46fb-a478-da6c4498df2d" alt="" width="508"><figcaption></figcaption></figure>

After authentication, SAML users assigned to the **Admin** SAML role will obtain the Form.io **Administrator** role, while those assigned to the **Member** role will receive the Form.io **Authenticated** role. This can be seen by inspecting the user object within the dev console.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fo0NNBDCHkzKoLay5O5ts%2Frolesuser.jpg?alt=media&#x26;token=dca75b7a-5065-419d-876b-553d59bd3a1b" alt=""><figcaption></figcaption></figure>

#### **Authentication Configuration**

The final step is to configure the Form.io Login form embedded in your application to support SAML. Alternatively, you can modify your application to support a similar process. Follow the link below for documentation.&#x20;

[**Form.io Authentication Configuration**](#form.io-authentication-configuration)

## Okta&#x20;

This section covers the [**Okta** ](https://okta.com)SAML application setup process and integration with the Form.io Project.&#x20;

### Create and Configure Application

1. From your Okta Admin dashboard, create a new Okta application by clicking **Applications** and then **Create App Integration**.

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FLDrekvBlh0CJ5y1ub4dN%2Foktaapplication.jpg?alt=media\&token=59a46d05-de0f-4ea0-b2e0-17bc45eb0727)

2. Select **SAML 2.0** from the modal window and click **Next**

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FPvzQleOGSwDpBTGiVYHz%2Fsaml2.jpg?alt=media\&token=163b272f-bc41-4fa7-b236-c9bc7db67abb)

3. Provide a **Name** for the application and click **Next**

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F29o7mJQiZWfoWtOpnDqg%2Fappname.jpg?alt=media\&token=62383ca0-b1a4-49e4-b1c1-64faa12da98e)

4. Provide the **Single Sign-On URL**\
   Copy your Form.io project endpoint and append **/saml/acs** at the end of the URL. \
   \
   \&#xNAN;*Example*:  if your project API endpoint is \
   \*\*<https://myproject.domain.com/abc123**\\>
   then your Assertion Consumer Service URL will be the following.

```
https://myproject.domain.com/abc123/saml/acs 
```

5. Provide the **Audience URI**\
   Copy your Form.io project endpoint and append the path **/saml/metadata** at the end of the URL. \
   \
   \&#xNAN;*Example*:  if your project API endpoint is \
   \*\*<https://myproject.domain.com/abc123**\\>
   then your Audience URI will be the following.

```
https://myproject.domain.com/abc123/saml/metadata
```

6. Ensure the **Name ID** format is set to **EmailAddress**
7. Ensure the **Application username** is set to **Email**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJdd3Ry2wILwKKsMyLKSL%2Foktaconfiguration.jpg?alt=media&#x26;token=3f6ebd3c-6565-4640-842e-3bb758cf36f8" alt="" width="497"><figcaption></figcaption></figure>

The **Attribute Statements** and **Group Attribute Statements** section is where we can define the name for different User Information (attributes) and define the name for SAML Groups. This will ensure the required information is provided by the SAML user when they authenticate.&#x20;

8. Set the following for the **Attribute Statements**

<table><thead><tr><th width="193">Name</th><th width="151">Format</th><th>Value</th></tr></thead><tbody><tr><td> email</td><td> Basic</td><td> user.email</td></tr><tr><td> firstName</td><td> Basic</td><td> user.firstName</td></tr><tr><td> lastName</td><td> Basic</td><td> user.lastName</td></tr></tbody></table>

8. Set the following for the **Group Attribute Statements**\
   Ensure the Matchest regex filter is set to: `.*`

<table><thead><tr><th width="187">Name</th><th width="151">Format</th><th>Filter</th></tr></thead><tbody><tr><td>groups</td><td>Unspecified</td><td>Matches regex:     <code>.*</code></td></tr></tbody></table>

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FZFgmhgR3ADbAus0DBK8S%2Fattributestatements.jpg?alt=media\&token=ac672add-e832-48dd-9631-473cd7fc1cfe)

9. Click **Next** to complete the configuration of your Okta SAML 2.0 application.

### Create Users

With the application configured, create a user base within the Okta Admin dashboard. These Users can then be assigned to a SAML group which will be associated with the SAML Application and allow for mapping between SAML Groups and Form.io roles.

1. Within your Okta Admin dashboard, click the **Directory** tab and select **People**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FmxhGop2KKArdJNgGoydg%2Fsamlpeople.jpg?alt=media&#x26;token=dc198cd0-d994-4100-8d8b-9564bebb7fdd" alt=""><figcaption></figcaption></figure>

2. Within the People tab, click the **Add** **Person** button
3. Enter person **details** for the SAML User
4. Click the **Password** dropdown to determine how Users password will be set
5. Click **Save** to add the User

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FNlo9VCQm0RsfMSnp6vVL%2Faddperson.jpg?alt=media&#x26;token=07c544c4-e1a0-4ec4-af42-0b61125a44d5" alt="" width="521"><figcaption></figcaption></figure>

### Create & Assign Groups

With our Users in place, the next step is to create **Groups** the SAML Users will be assigned to.  This will allow us to establish mappings between SAML Groups and Form.io roles.&#x20;

1. Within your Okta Admin dashboard, click the **Directory** tab and select **Groups**
2. Click the **Add Group** button

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FImxezlodIYs1ZDTH11sJ%2Fgroupsdirectory.jpg?alt=media\&token=52e40ce9-1a9f-44e3-ac86-833e8471886e)

3. Give your Group a **Name** and click **Save**&#x20;

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FRdQkOczNQLANKalyJ9Ji%2Faddgroup.jpg?alt=media\&token=8f16a70f-f5dd-4771-acb6-5b8df6fd6824)

With a Group created, the next step is to assign users to the Group.

4. From the **Group** tab, select the Group to add Users to
5. Click the **Assign people** button&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FMB0tRFGTBmwF05WEghDt%2Fmembergroup.jpg?alt=media&#x26;token=d69e6bc8-4a30-47b3-ac6e-3721c582e1d3" alt="" width="563"><figcaption></figcaption></figure>

6. Click the **+** button next to a User to assign them to a Group

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fvswyl6xJ6drwtTX8jMan%2Fadduser.jpg?alt=media&#x26;token=a195c3aa-9363-4714-91e0-8da821b264a1" alt=""><figcaption></figcaption></figure>

#### **Assign Groups To SAML Application**

7. To assign the Group, open the **Directory** tab, select the **Group,** and click the **Applications** tab&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FNekdAMeS1dKXBtadyVk0%2Fassignapplication.jpg?alt=media&#x26;token=ef7d7920-2baf-45d1-b1d8-3cbd970d2f11" alt="" width="563"><figcaption></figcaption></figure>

8. Click the **Assign applications** button
9. Within the modal window, click the **Assign** button next to your **SAML application**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fx8bztGtpSFkuFPGAm0hz%2Fassignapp.jpg?alt=media&#x26;token=3a889c2e-83ff-463b-82b7-4abf0e2b1b22" alt="" width="465"><figcaption></figcaption></figure>

### Passport Configuration

Once the SAML application setup is finalized, XML data will be extracted from the application and utilized for building the Passport Configuration. This JSON configuration will be saved to the Form.io Project to complete the integration. &#x20;

{% hint style="info" %}
[**Click Here**](#saml-passport-config) for more information about SAML Passport Configurations
{% endhint %}

1. Within the Okta Admin Dashboard, click the **Application** tab and select your SAML app
2. Click the **Sign On** tab and copy the **Metadata URL**
3. Copy the **Metadata URL** and open the URL within your browser&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FX6VZ4CX22uR5Dtc56SGp%2Fcopymeta.jpg?alt=media&#x26;token=e4f0806d-68ac-45b3-a710-605145de2a89" alt="" width="560"><figcaption></figcaption></figure>

4. Store the XML information as it will be used to construct the **Passport Config**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F7c4zIOpPGKaOhXbnyu5h%2Fxml.jpg?alt=media&#x26;token=c8fd75bc-cb5a-49cc-9daf-f087abc022f0" alt="" width="563"><figcaption></figcaption></figure>

5. Construct the **Passport Config JSON** object. Search the XML file for the property names within the example below and input the data accordingly.&#x20;
   * The **identityProviderUrl** and **entryPoint** endpoints can be found by searching  **SingleSignOnService** &#x20;
   * The **cert** can be found by searching the **X509Certificate**
   * The **identifierFormat** can be found by searching **NameIDFormat** (emailAddress endpoint)
   * The **issuer** can be found by searching the **entityID**
   * The **audience** must match the **Audience Restriction** endpoint within the **General** tab of your Okta SAML application.&#x20;

{% hint style="info" %}
Quickly generate the JSON object by utilizing the [**SAML Passport Generator**](#saml-passport-generator) found within the SAML Settings of the Form.io Project.&#x20;
{% endhint %}

Example Template:

<pre><code><strong>{"identityProviderUrl": "https://trial-3793339.okta.com/app/trial-3793339_formiossoauthentication_1/abc123/sso/saml",
</strong>  "entryPoint": "https://trial-3793339.okta.com/app/trial-3793339_formiossoauthentication_1/abc123/sso/saml",
  "cert": "abc123",
  "identifierFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
  "issuer": "http://www.okta.com/abc123",
  "audience": "https://yourdomain.com/myproject/saml/metadata"}
</code></pre>

### Form.io Integration

With the Passport Config JSON object constructed, the Form.io project can now be configured.

1. Within the Form.io Project, click **Settings** > **Authentication** > **SAML**
2. Click the **Authorization Settings** tab

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJJBfrCSU1b5gybWYA3Bl%2Fauthsettings.jpg?alt=media&#x26;token=91d11107-00c3-4e0f-a180-ddfd519f8835" alt=""><figcaption></figcaption></figure>

3. Scroll down and paste the **Passport Config** JSON from the previous step

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FgGOQ7CD9MP5ntz5H7AaZ%2Foneloginsamlpassport.jpg?alt=media&#x26;token=104a7f97-ce07-4246-a990-03d6e48c294b" alt="" width="563"><figcaption></figcaption></figure>

4. Click the **Configuration** tab and add the following to the **Email Path** setting field\
   `email`
5. **Save** your settings

#### **Role Mapping**

In many cases, you may want to map the SAML Role associated with the SAML User to a Form.io Role. Apply the following configurations to configure the Role mappings.&#x20;

6. Within the Form.io SAML settings, click the Configuration tab and set the following to the **Role Path**\
   [`groups`](#user-content-fn-1)[^1]

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FThEzoAc9eM6BJ6IcxVUG%2Fgroups.jpeg?alt=media&#x26;token=9b437b1b-cc02-431e-9d23-d6a2162c0906" alt=""><figcaption></figcaption></figure>

7. Within your **Okta** **SAML Application,** click the **Assignments** tab and click **Groups**.\
   Take note of the **Group** **Names** assigned to the application.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F0mMTN2dUfMMzRUd9szfn%2Frolenames.jpg?alt=media&#x26;token=d9b7be8e-b496-41c0-9763-b02fd7b8ddfa" alt="" width="542"><figcaption></figcaption></figure>

8. Back to the Form.io SAML settings, scroll down to the **Role Mapping** setting
9. Map **Okta** **SAML** **Groups** (case sensitive) to the desired **Form.io Roles**
10. **Save** your settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F1Zk8LREZ03PO8zWCFrYm%2Frolemappings.jpeg?alt=media&#x26;token=a7036e47-d9c1-4855-8502-1dad962b88ec" alt="" width="508"><figcaption></figcaption></figure>

After authentication, SAML users assigned to the **Admin** SAML role will obtain the Form.io **Administrator** role, while those assigned to the **Member** role will receive the Form.io **Authenticated** role. This can be seen by inspecting the user object within the dev console.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FrgtaPIE0AYBvQ3z4SJgD%2Fuserobject.jpg?alt=media&#x26;token=9f7ea199-853e-44cb-8fc4-dc4d1f374ecf" alt=""><figcaption></figcaption></figure>

#### **Authentication Configuration**

The final step is to configure the Form.io Login form embedded in your application to support SAML. Alternatively, you can modify your application to support a similar process. Follow the link below for documentation.&#x20;

[**Form.io Authentication Configuration**](#form.io-authentication-configuration)

## Microsoft Entra ID&#x20;

This section covers the [**Microsoft Entra ID**](https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id) SAML application setup process and integration with the  Form.io Project.&#x20;

{% hint style="info" %}
The UI and theming may differ slightly between the free plan and paid plan
{% endhint %}

### Create and Configure Application

1. After setting up your account, navigate to the [**Azure Portal**](https://portal.azure.com/), click the left navigation panel, and select **Microsoft Entra ID**.

![Azure AD Portal](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fiok3Tkq5U6lRbLEg3jlH%2Fmicrosoftentra.jpg?alt=media\&token=cc4bb67e-c04b-4cda-a574-526aa058abcb)

2. Within the left-hand navigation bar, select **Enterprise Applications**&#x20;

![Enterprise Applications](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FEUgWHBCewMWxYwliJDaj%2Fenterpriseapplication.jpg?alt=media\&token=407e9b15-136b-42db-8f44-16f7ed6ae477)

3. Click the **+New Application** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FlnhO8K2UDWAoiOa93TB9%2FNewApplication.jpg?alt=media&#x26;token=f29c4139-1c82-4f6f-9228-1cc7bbdb4806" alt=""><figcaption></figcaption></figure>

4. Search and select **Entra SAML Toolkit**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FeGRtNWuP08LhUBFW7qUy%2Fsearchentra.jpg?alt=media&#x26;token=69769e21-2515-4a52-b800-92b3425e70c5" alt=""><figcaption></figcaption></figure>

5. Give the **Application** a name and click the **Create** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FgWdosOO2MdZ6B5V7o0uf%2Fcreatetoolkit.jpg?alt=media&#x26;token=0caf498d-74d3-40d7-8e58-5f5cada53d39" alt="" width="544"><figcaption></figcaption></figure>

6. Within the Entra ID application, click the **Single sign-on** button in the **Manage** toolbar
7. Select the **SAML** option&#x20;

   <figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FvbfNwj7BcSud6moZJCyM%2Fsamloption.jpg?alt=media&#x26;token=637f2c69-1a3f-4a49-b5ba-f9c81ad3e886" alt=""><figcaption></figcaption></figure>
8. Within the application **Set up** section, scroll down and copy the **Microsoft Entra Identifier** endpoint. Save this ID for later.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FNPCNEQqcsgBgFuekO70A%2FsamlID.jpg?alt=media&#x26;token=08f97f5f-5624-439e-b7a9-5e62753faf64" alt="" width="563"><figcaption></figcaption></figure>

9. Scroll back up to the **Basic SAML Configuration** section and click the **Edit** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FkCNEf9nNjuTsflEcy75X%2FSAMLedit.jpg?alt=media&#x26;token=cd3c2e48-b4b7-47a4-9785-72f891cb735d" alt=""><figcaption></figcaption></figure>

10. Apply the following **SAML Configuration** for the Application

* Click the **Add Identifier** button and input the **Identifier (Entity ID)** - Microsoft Entra Identifier copied in the previous step\
  `https://sts.windows.net/abc-123-def-456`
* Add the **Reply URL** (Assertion Consumer Service URL) - [**Live Endpoint** ](https://help.form.io/userguide/projects/project-ui#header)of the Form.io Project application with form.io/saml/acs appended at the end of the URL. \
  `https://myproject.domain.com/abc123/saml/acs`&#x20;
* Add the **Sign On URL** - Application domain endpoint\
  `https://myapplication.domain.com`
* **Save** the settings

![Edit Basic Information](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FeXPCMqTh9VJImpWI57lm%2Fbasicsamlconfig.jpg?alt=media\&token=b144e005-8f5d-4281-bbc6-b96a1045d838)

11. Within the **Single sign-on** of your application, click the **Edit** button for the **SAML Certificates**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fm7Y7FbhMcmsLecINybXM%2Fsamlcert.jpg?alt=media&#x26;token=fb10061d-d87f-4d85-8b5b-d38b7e432ca9" alt=""><figcaption></figcaption></figure>

12. Set **Signing Option** to **Sign SAML response and assertion**
13. Set **Signing Algorithm** to **SHA-256**
14. Click the **Save** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F4sY0jk695E8O9ChzPwj0%2Fcertificatesettings.jpg?alt=media&#x26;token=28ffc598-1c15-43f6-996b-9d7978bccb78" alt=""><figcaption></figcaption></figure>

### Create Users

With the application configured, we can now add Users that will authenticate against Entra ID.&#x20;

1. Return to the **Entra ID Portal**&#x20;
2. Within the left-hand navigation bar, click the **Manage** tab and then **Users**

{% hint style="info" %}
Ensure you [**assign Microsoft License**](https://learn.microsoft.com/en-us/entra/fundamentals/license-users-groups) to users or groups within Entra ID&#x20;
{% endhint %}

2. Click the **+New User** button

<div align="left"><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJZACWjDp4ArSkR6DweDz%2Fcreateuser.jpg?alt=media&#x26;token=817eef87-6e8e-4af2-bb35-3093f26e2bf0" alt="users"></div>

3. Input the User information and click **Review + create** button
4. Select how the **User** **Password** should be set

{% hint style="warning" %}
Ensure the User **email address** and **name** is set within the **Properties** tab of the user profile

Contact your Azure administrator if these properties are not available
{% endhint %}

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fqczhf8pj6fGWuL6sMyUH%2Fcreatenewuser.jpg?alt=media&#x26;token=5fec16e6-aca2-44de-981c-cfeb08265a5e" alt="" width="491"><figcaption></figcaption></figure>

5. Click the **Create** button after reviewing the User information
6. Create several other users to test Group and Role mapping detailed in the next section.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FIqFrDegEXyDnKJ1sg6jr%2Fusers.jpg?alt=media&#x26;token=f6f55e8a-664c-4d0f-9b4c-cee1df682fd5" alt=""><figcaption></figcaption></figure>

### Create & Assign Groups

With our Users in place, the next step is to create **Groups** the Entra ID Users will be assigned to. This will allow us to establish mappings between SAML Groups (Roles) and Form.io roles.

1. Click the **Groups** tab and **All Groups** within the left-hand navigation bar.&#x20;

{% hint style="info" %}
Ensure you a [**assign Microfosft License**](https://learn.microsoft.com/en-us/entra/fundamentals/license-users-groups) to users or groups within Entra ID&#x20;
{% endhint %}

2. Click the **+New Group** button&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F6EJVvxmt4Bplbq6tlggN%2Fgroups.jpg?alt=media&#x26;token=0bdda339-8056-4c74-af79-f8182db9d2be" alt=""><figcaption></figcaption></figure>

3. Give the Group a **Group Name** and keep the remaining settings at their default values

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F1xKhNxdCl7gKJQpP0ji0%2Fgroupinformation.jpg?alt=media&#x26;token=ff1b2491-f1ff-41d0-84ea-c6d02982fc49" alt="" width="521"><figcaption></figcaption></figure>

4. Click the the **Create** button&#x20;
5. Return to the main Group page and click the **Group** we just created

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FYqx12JDPmcBYzCtM1oAd%2Fselectmember.jpg?alt=media&#x26;token=37f19845-8302-4019-80dd-e5ae284a9586" alt="" width="563"><figcaption></figcaption></figure>

6. Expand the **Manage** tab and click **Members**&#x20;
7. Click the **+Add members** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FXcszx94aKBpo1NO75JPE%2Faddmember.jpg?alt=media&#x26;token=98a9e8c4-a863-4976-99eb-7e55f0c3ea48" alt=""><figcaption></figcaption></figure>

6. **Search** for the User created in the previous section
7. Tick the **checkbox** next to the members you wish to add
8. Click the **Select** button at the bottom of the page

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FWAzuLM1NrglHmfvCHDtB%2Faddmember.jpg?alt=media&#x26;token=1d264e02-a438-41dc-b078-bdbaa3b9e2d2" alt="" width="563"><figcaption></figcaption></figure>

9. Follow the same steps to create additional Groups

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fh7h3pTZ82CdslPQugEz1%2Fgroupscreated.jpg?alt=media&#x26;token=ea9aca30-30ba-4f41-a148-58b600192920" alt=""><figcaption></figcaption></figure>

#### **Enable Group Claims**

With the Groups established, the next step is to enable the Group claim within the Entra ID application.&#x20;

1. Navigate back to your **Entra ID SAML** application
2. Click the **Single sign-on** tab
3. Edit the **Attributes & Claims** section

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fez6zqdLxWQ6NVjEYi7pr%2Fgroupattributes.jpg?alt=media&#x26;token=2a098328-f48a-43ba-b7a8-91bf02971219" alt=""><figcaption></figcaption></figure>

4. Click the **+Add a group claim** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FpxmpT9mqNVrreNMpHIT0%2Fgroupclaim.jpg?alt=media&#x26;token=52636f86-cc32-41b0-9aab-dd535cf95888" alt=""><figcaption></figcaption></figure>

5. Select the **Groups assigned to the application** option
6. Click the **Source attribute** dropdown and select the **Cloud-only group display names** option
7. **Save** the claim

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FolljFCJS4mEeK4cvERmk%2Fgroupclaimsettings.jpg?alt=media&#x26;token=08b5ec34-e2c7-4683-b1f9-c993c157118b" alt="" width="443"><figcaption></figcaption></figure>

8. Within the Attributes & Claim page, take note of the **Group Claim** endpoint \
   `http://schemas.microsoft.com/ws/2008/06/identity/claims/groups`

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FagHeV7bvSFXQ2uaI6i7M%2Fclaimendpoint.jpg?alt=media&#x26;token=d6b8b82d-0447-4eed-862a-777c748edda6" alt=""><figcaption></figcaption></figure>

#### **Assigning Groups to Application**

1. Navigate back to your **Entra ID SAML** application
2. Select the **Assign users and groups** tab then click the **+ Add user/group** button
3. On the next screen, click the **None Selected**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fti3LDPDGTph3PeyD9s12%2Fassigngroups.jpg?alt=media&#x26;token=a9a0f24f-6b04-4d4f-b168-b378eb0b23aa" alt=""><figcaption></figcaption></figure>

4. Tick the checkbox next to the **Groups** you wish to assign to the application
5. Click the **Select** button at the bottom of the screen and then **Assign** on the following page

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fa0umOs59kuPGf1tkdYIk%2Fselectgroups.jpg?alt=media&#x26;token=ebef4c14-c1c0-44e8-b76c-3ef026f8b12e" alt="" width="563"><figcaption></figcaption></figure>

After assigning the Groups, you should see the Groups displayed within the User and Groups tab of the Entra ID application. Users assigned to the selected groups will be associated with the Entra ID Application.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FzyNmWqi4kabKplJIlVgr%2Fgroupsassigned.jpg?alt=media&#x26;token=8d9aab43-8a92-4d0a-9afc-edc97893d6cb" alt=""><figcaption></figcaption></figure>

### Passport Configuration

Once the SAML application setup is finalized, XML data will be extracted from the application and utilized for building the Passport Configuration. This JSON configuration will be saved to the Form.io Project to complete the integration.

{% hint style="info" %}
[**Click Here**](#saml-passport-config) for more information about SAML Passport Configurations
{% endhint %}

#### **Download XML File**

1. Navigate to your **Entra ID SAML** application
2. Click the **Single sign-on** tab
3. Within the **SAML Certificates** click the **download** button for the **Federation Metadata XML**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FTepPt9R6CYfmGyl9sZUJ%2Fdownloadxml.jpg?alt=media&#x26;token=3a283171-368e-4527-9c38-1774c392c728" alt="" width="563"><figcaption></figcaption></figure>

4. Store the XML information as it will be used to construct the **Passport Config**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FotIQOSvdjipmWLmpzVvI%2Fxml.jpg?alt=media&#x26;token=31a4f67e-abc1-4508-ba8e-0e854bf64b6e" alt="" width="563"><figcaption></figcaption></figure>

5. Construct the **Passport Config JSON** object by locating the parameter titles in the XML file as shown in the example below, and input your specific data accordingly

```
{"identityProviderUrl": "https://login.microsoftonline.com/abc-123-def-456/saml2",
  "entryPoint": "https://login.microsoftonline.com/abc-123-def-456/saml2",
  "logoutUrl": "https://login.microsoftonline.com/abc-123-def-456/saml2",
  "cert": "abc123def567",
  "issuer": "https://sts.windows.net/1234-9f02-4c3a-abd-1234/",
  "callbackUrl": "https://app.domain.com/form.io/saml/acs",
  "signatureAlgorithm": "sha256"}
```

* The **identityProviderUrl**, **entryPoint**, and **logoutUrl** endpoint can be found by searching the **SingleSignOnService**&#x20;
* The **cert** can be found by searching the **X509Certificate**
* The **issuer** can be found by searching the **entityID**
* The **callbackUrl** must match the **Reply URL** endpoint within the **Single sign-on** tab of your Entra ID application
* The **signatureAlgorithm** will be set to **sha256**

{% hint style="info" %}
Quickly generate the JSON object by utilizing the [**SAML Passport Generator**](#saml-passport-generator) found within the SAML Settings of the Form.io Project.&#x20;
{% endhint %}

### Form.io Integration

With the Passport Config JSON object constructed, the Form.io project can now be configured.

1. Within the Form.io Project, click **Settings** > **Authentication** > **SAML**
2. Click the **Authorization Settings** tab

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJJBfrCSU1b5gybWYA3Bl%2Fauthsettings.jpg?alt=media&#x26;token=91d11107-00c3-4e0f-a180-ddfd519f8835" alt=""><figcaption></figcaption></figure>

3. Scroll down and paste the **Passport Config** JSON from the previous step

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FXlW1hKtkVkEFdM9BxjDo%2Fentraidpassportjson.jpg?alt=media&#x26;token=1d0ec321-ec66-4772-8934-d6222840fc84" alt="" width="563"><figcaption></figcaption></figure>

4. Click the **Configuration** tab and add the following to the **Email Path** setting field\
   `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name`
5. Save your **Settings**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F2j25c1rKTZxOCXvqP04q%2Femailpath.jpg?alt=media&#x26;token=0df1f08c-e537-4ff3-b2ce-061e47aa4444" alt=""><figcaption></figcaption></figure>

#### **Role Mapping**

In many cases, you may want to map the SAML Role associated with the SAML User to a Form.io Role. Apply the following configurations to configure the Role mappings.

6. Within the Form.io SAML settings, click the Configuration tab and set the following to the **Role Path**\
   `http://schemas.microsoft.com/ws/2008/06/identity/claims/groups`

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FTPxLgM2flZH6PReqe8Mu%2Froles.jpg?alt=media&#x26;token=fb75d252-2590-478e-b2ed-e057e4f6e1de" alt="" width="500"><figcaption></figcaption></figure>

7. Back to your **Entra ID** **SAML Application,** click the **Users and group** tab. Take note of the **Group** **Names** assigned to the application.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FPjUAAowNG5IfGu8Zf13k%2Fgroupsassigned.jpg?alt=media&#x26;token=4fb91cbf-d63e-46b8-b450-c30f6f4d710a" alt=""><figcaption></figcaption></figure>

8. Back to the Form.io SAML settings, scroll down to the **Role Mapping** setting
9. Map **SAML** **Roles** (case sensitive) to the desired **Form.io Roles**
10. **Save** your settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FsVNcV0VckoMezsSy3QSB%2Frolemappings.jpg?alt=media&#x26;token=f3d2b8da-1086-46fb-a478-da6c4498df2d" alt="" width="508"><figcaption></figcaption></figure>

After authentication, SAML users assigned to the **Admin** SAML role will obtain the Form.io **Administrator** role, while those assigned to the **Member** role will receive the Form.io **Authenticated** role. This can be seen by inspecting the user object within the dev console.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FohrWT9Jd6huxocgiodt1%2Fuserobject.jpg?alt=media&#x26;token=daad5fc2-2083-4f5b-b2a8-a13a4decad02" alt=""><figcaption></figcaption></figure>

#### **Authentication Configuration**

The final step is to configure the Form.io Login form embedded in your application to support SAML. Alternatively, you can modify your application to support a similar process. Follow the link below for documentation.&#x20;

[**Form.io Authentication Configuration**](#form.io-authentication-configuration)

## AuthO&#x20;

This section covers the [**Auth0 Provider**](https://auth0.com/docs/authenticate/protocols/saml/saml-configuration) SAML application setup process and integration with the  Form.io Project.&#x20;

### Create and Configure Application

1. From your Auth0 Admin dashboard, create a new Auth0 by clicking the **Applications** tab and clicking the **+Create Application** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FiSLCliW3XsSJuYWb3Y6k%2Fauth0application.jpg?alt=media&#x26;token=0b2f52d2-4590-427a-b39b-25fe3bd851a8" alt=""><figcaption></figcaption></figure>

2. From the application Modal window, select **Single Page Web Applications**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FoyJzwE8rg77mbUUuNdsj%2Fapplicationselection.jpg?alt=media&#x26;token=f61ed4d9-f9aa-43ba-8621-cab24e374e66" alt="" width="563"><figcaption></figcaption></figure>

3. Provide a **name** for the Application and click the **Create** button&#x20;
4. Click the **Addons** tab&#x20;
5. Toggle the **SAML 2.0** button&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FXQ9EGBvHBxgBmy74oNsN%2Faddontab.jpg?alt=media&#x26;token=a7ba2bb6-832f-47fe-b964-35255ab939da" alt=""><figcaption></figcaption></figure>

6. Click the **Settings** tab&#x20;
   * Within the Modal window, provide the **Allowed Callback URL.**\
     Also known as the [**ACS** **endpoint**](#user-content-fn-2)[^2] by other SAML providers. \
     For this value, copy your Form.io project endpoint and append **/saml/acs** at the end of the URL. \
     \
     \&#xNAN;*Example*:  if your project API endpoint is \
     **<https://yourdomain.com/myproject>**, \
     then your Assertion Consumer Service URL will be the following.\
     `https://yourdomain.com/myproject/saml/acs`

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FuTg5YUgGYSsXhNIxKGD8%2Fsaml2settings.jpg?alt=media&#x26;token=11a708be-7810-4fe0-90d5-039d1f0dc1ae" alt="" width="468"><figcaption></figcaption></figure>

* Scroll down and click the **Enable** button
* After enabling the application, click **Save**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fy6QiJ9MVD6FtGkX6MGP4%2Fenable.jpg?alt=media&#x26;token=c0acac73-9721-4672-8077-55e456d5d8e8" alt="" width="480"><figcaption></figcaption></figure>

The application should now be ready for SAML Authentication. The next step is to create Groups the SAML users will be assigned to. These Groups will then be mapped to Form.io roles for granular permissions.&#x20;

### Create Users

With the application configured, create a user base within the Auth0 Admin dashboard. These Users can then be assigned to a SAML group which will be associated with the SAML Application and allow for mapping between SAML Groups and Form.io roles.

1. Within the Auth0 admin dashboard, click the **User Management** tab and then **Users**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FFqKMTa4zTuYQYiP2BKv9%2Fusermanagement.jpg?alt=media&#x26;token=705a1c7a-c8ca-4f45-b6a7-ae012d901242" alt=""><figcaption></figcaption></figure>

2. Click the **+Create User** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FN9ClGRz8eazZu3RNW85W%2Fcreateuser.jpg?alt=media&#x26;token=3d07d216-8859-469d-beff-f0df8b19e599" alt="" width="563"><figcaption></figcaption></figure>

3. Input user information and click **Create**

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FzykLf7h3gJ5Mw4pPhOeC%2FUsers%202022-05-04%2014-01-57.png?alt=media\&token=66ea0fd5-d078-4765-86cc-dbbaeddd4c20)

4. Create additional users to assign to the different Roles that will be established in the next step.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F2wa7xmRp9XRDKm26FINW%2Fusergroup.jpg?alt=media&#x26;token=c1b77754-4c2a-4cbd-a388-289a3ac59d2c" alt=""><figcaption></figcaption></figure>

### Create & Assign Groups

With our Users in place, the next step is to create **Groups** the SAML Users will be assigned to.  Auth0 groups are created and managed through extensions. This group extension will allow us to establish mappings between SAML groups and Form.io roles for granular permissions.

1. Within the left-hand navigation bar, click **Extensions**
2. Select **Auth0 Authorization**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fwo72gltry3ZtPR5Vuajs%2Fextension.jpg?alt=media&#x26;token=4f97e42e-2492-41b9-9d1f-f7b449a3602b" alt=""><figcaption></figcaption></figure>

3. Click **Install** within the Extension modal

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FhJXAKRtcO8ZAR8p9mhmT%2Finstallextension.jpg?alt=media&#x26;token=61a6e7bd-2263-4a0f-b391-dfbdd51846ac" alt="" width="563"><figcaption></figcaption></figure>

4. Once installed, click the **Extension** and **Authorize** the extension for your application
5. Click the **GO TO CONFIGURATION** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fa2ZJTTzTf0M0ZzaKnUXi%2Fgotoconfig.jpg?alt=media&#x26;token=0adf8a1b-cd34-47a3-9bc6-7b19779f437e" alt=""><figcaption></figcaption></figure>

6. Click the **Groups** radio button
7. Click the **Publish Rule** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FBLBdYhfh7DWKrCcjZ21X%2Fgroupspublish.jpg?alt=media&#x26;token=245345df-9fa7-4e22-a595-851a172bfdc9" alt=""><figcaption></figcaption></figure>

8. Within the Extension, click the **Groups** tab then **+ Create Your First Group** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FA0aqO3SxuuBDZ6d6T9SY%2Fgroups1.jpg?alt=media&#x26;token=3cac3719-b48d-4a89-9af9-360e2c3aa77e" alt=""><figcaption></figcaption></figure>

9. Give the Group a **Name** and **Description**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fyb7rBJKhqdNVKwUUEbvC%2Fcreategroup1.jpg?alt=media&#x26;token=08ca3cc9-bc99-4be7-8afd-feea824f9880" alt="" width="488"><figcaption></figcaption></figure>

10. Click the **+Add Member** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F8ulewwh0tVXreRXQUQdm%2Faddmember.jpg?alt=media&#x26;token=2284dfcd-3ea1-42d7-bd40-a999ebd86aad" alt="" width="563"><figcaption></figcaption></figure>

11. Search and **select** the **user(s)** to assign to the Group and **Save**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fct5pO7l5hyVi68WDEKDE%2Faddmember1.jpg?alt=media&#x26;token=4cb6bd77-e85c-4262-ae57-46a5e21a854a" alt=""><figcaption></figcaption></figure>

### Passport Configuration

Once the SAML application setup is finalized, XML data will be extracted from the application and utilized for building the Passport Configuration. This JSON configuration will be saved to the Form.io Project to complete the integration.

{% hint style="info" %}
[**Click Here**](#saml-passport-config) for more information about SAML Passport Configurations
{% endhint %}

1. Within the Auth0 Admin Dashboard, click the **Application** tab and select your SAML app
2. Click the **Add On** tab and click the **SAML2 Web App**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F30NI9SDIMHgDTQIilF9s%2Fsamladdon.jpg?alt=media&#x26;token=d6ee292c-4b2f-445b-9e69-8b4990fdd7fe" alt="" width="563"><figcaption></figcaption></figure>

3. Within the **Usage** tab, click the **Download** to extract the XML file

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FRCFJx4PQVqeiAm9mJf8z%2Fdownloadxml.jpg?alt=media&#x26;token=4905ebdc-cae4-4219-9189-0d6669f2fcbc" alt="" width="477"><figcaption></figcaption></figure>

4. Store the XML information as it will be used to construct the **Passport Config**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FOfSW1djdadZVdYH4b93L%2Fxmldownload.jpg?alt=media&#x26;token=c57f7eae-038a-45d0-8c78-402f92efd8ff" alt="" width="563"><figcaption></figcaption></figure>

5. Construct the **Passport Config JSON** object. Search the XML file for the property titles within the example below and input the data accordingly.&#x20;
   * The **identityProviderUrl** and **entryPoint** endpoint can be found by searching the **SingleSignOnService**  HTTP-REDIRECT endpoint
   * The **cert** can be found by searching the **X509Certificate**
   * The **identifierFormat** can be found by searching **NameIDFormat**
   * The **logoutUrl** endpoint can be found by searching **SingleLogoutService**
   * The **callbackURL** must match the **Application Callback URL** endpoint within the **Setting** tab of your Auth0 SAML application.&#x20;
   * The **issuer** can be found by searching the **entityID**
   * Set the **wantAuthnResponseSigned** to **false**

{% hint style="info" %}
Quickly generate the JSON object by utilizing the [**SAML Passport Generator**](#saml-passport-generator) found within the SAML Settings of the Form.io Project.&#x20;
{% endhint %}

```
{"identityProviderUrl": "https://dev-3co66mp5xvfzciov.us.auth0.com/samlp/abc123", 
"entryPoint": "https://dev-3co66mp5xvfzciov.us.auth0.com/samlp/abc123", 
"cert": "abc123def456", 
"identifierFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", 
"callbackUrl": "http://localhost:3000/ipajzfemjjsisnv/saml/acs",
"issuer": "urn:dev-abc123.us.auth0.com",
"wantAuthnResponseSigned": false}
```

### Form.io Integration

With the Passport Config JSON object constructed, the Form.io project can now be configured.

1. Within the Form.io Project, click **Settings** > **Authentication** > **SAML**
2. Click the **Authorization Settings** tab

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FJJBfrCSU1b5gybWYA3Bl%2Fauthsettings.jpg?alt=media&#x26;token=91d11107-00c3-4e0f-a180-ddfd519f8835" alt=""><figcaption></figcaption></figure>

3. Scroll down and paste the **Passport Config** JSON from the previous step

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FGxd5hmf983L1UK0SMRo4%2Fauth0passportjson.jpg?alt=media&#x26;token=40a2ccbf-37d9-4e33-9cff-1b2c375f492c" alt="" width="563"><figcaption></figcaption></figure>

4. Click the **Configuration** tab and add the following to the **Email Path** setting field\
   `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name`
5. **Save** your settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F2j25c1rKTZxOCXvqP04q%2Femailpath.jpg?alt=media&#x26;token=0df1f08c-e537-4ff3-b2ce-061e47aa4444" alt=""><figcaption></figcaption></figure>

#### **Role Mapping**

In many cases, you may want to map the SAML Role associated with the SAML User to a Form.io Role. Apply the following configurations to configure the Role mappings.

6. Within the Form.io SAML settings, click the Configuration tab and set the following to the **Role Path**\
   `http://schemas.xmlsoap.org/claims/Group`

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F58o89ATJOBWqlHkYWtbE%2FRolesPath.jpg?alt=media&#x26;token=a37ad4ad-ec88-4922-8cbf-f6df547cfbfa" alt="" width="539"><figcaption></figcaption></figure>

7. Within your **Auth0** **SAML application,** click the **Extensions** tab, and the **Auth0 Authorization** extension.&#x20;
8. Click the **Groups** tab and take note of the **Groups** **Names** assigned to the extension.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FHbDCQNX6YfPg4P29cjC2%2Fgroupsextension.jpg?alt=media&#x26;token=ae34bde8-6622-4ab4-a464-6d60938a9cf0" alt=""><figcaption></figcaption></figure>

9. Back to the Form.io SAML settings, scroll down to the **Role Mapping** setting
10. Map **SAML** **Roles Names** (case sensitive) to the desired **Form.io Roles**
11. **Save** your settings

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F1Zk8LREZ03PO8zWCFrYm%2Frolemappings.jpeg?alt=media&#x26;token=a7036e47-d9c1-4855-8502-1dad962b88ec" alt="" width="508"><figcaption></figcaption></figure>

After authentication, SAML users assigned to the **Admin** SAML role will obtain the Form.io **Administrator** role, while those assigned to the **Member** role will receive the Form.io **Authenticated** role. This can be seen by inspecting the user object within the dev console.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FSJUJjjb6rB5dZo2zrMWo%2Fuserobject.jpg?alt=media&#x26;token=32d6d619-5705-4e00-a452-76786bb4d821" alt=""><figcaption></figcaption></figure>

#### **Authentication Configuration**

The final step is to configure the Form.io Login form embedded in your application to support SAML. Alternatively, you can modify your application to support a similar process. Follow the link below for documentation.&#x20;

[**Form.io Authentication Configuration**](#form.io-authentication-configuration)

## Form.io Authentication Configuration  &#x20;

SAML Authentication can be set up either by utilizing a Form.io Login form or by modifying the code within your application

### **Login Form Configuration**

Follow the steps below to achieve SAML SSO authentication using a Form.io Login form.

1. Edit the authentication Form embedded within your application
2. Drag and drop a **Button** component&#x20;
3. Modify the **Label** to reflect SAML authentication
4. Click the **Action** dropdown and select **Custom**&#x20;
5. Copy the following code and paste it into the **Button Custom Logic** code block

```javascript
Formio.ssoInit('saml');
```

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F8Gm5Eim9qkHqr8NIjmpG%2Fbuttonlogic.jpg?alt=media\&token=3945066d-8620-40e5-a31f-62d8e3921ab6)

6. Add a **Hidden** component&#x20;
7. Click the **Data** tab and open the **Custom Default Value** tab
8. Add the following **JavaScript** within the code block
9. **Save** the Settings and Form

```javascript
if (Formio.pageQuery().saml) {
  Formio.ssoInit('saml');
  window.location.replace('/');
}
```

![](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MPHoF2HwOA0s5HV_AIB%2F-MPkVy0fPX_6GTdReOws%2F-MPkWDpa2Liy-dRTf0vo%2FScreen%20Shot%202020-12-29%20at%204.00.56%20PM.png?alt=media\&token=41ec03c6-0477-46da-88ef-7f7083b2bd1b)

### Application Configuration

To achieve authentication within your application, the following code will instigate the SSO process.

```javascript
import { Formio } from '@formio/js';
Formio.ssoInit('saml');
```

The `Formio.ssoInit` method is used to both instigate the SSO process as well as handle the callback once the authentication occurs. Because of this, it may be beneficial to place this code within a button on  so that the login will occur once you click on a "Login" button, and then trigger the `Formio.ssoInit` method once the page returns with the `?saml=` query parameter (which indicates that the SSO process has completed).

```javascript
<button class="btn btn-primary" role="button" onclick="Formio.ssoInit('saml')">Login</button>
<script type="text/javascript">  
  // Check to see if the saml query is provided.
  if (Formio.pageQuery().saml) {
    // Perform the login.
    Formio.ssoInit('saml');
    
    // Navigate to the homepage after they login.
    window.location.replace('/');
  }
</script>
```

## SAML Passport Configuration

The "Passport Config" setting simplifies the process of configuring SAML authentication settings for your Form.io project, allowing you to specify how your application interacts with the SAML identity provider using JSON configuration. Passport then utilizes this configuration to manage the authentication flow and grant access to authenticated users

{% hint style="info" %}
Form.io utilizes the Node.js SAML Authentication library. \
[**Click Here** ](https://github.com/node-saml/node-saml)for documentation and a full list of SAML Passport properties&#x20;
{% endhint %}

As an example, many Microsoft Azure Active Directory deployments do not cryptographically sign their SAML assertions (despite signing the top-level SAML response). Form.io, however, expects both the SAML response and the SAML assertions to be signed by default. In this case, your Passport Config JSON object would set the `wantAssertionsSigned` parameter to false, and might look something like this:

```
{
  "identityProviderUrl": "<identity provider URL>"
  "entryPoint": "<entry point URL>",
  "logoutUrl": "<logout url>",
  "cert": "<cert>",
  "issuer": "<issuer url>",
  "audience" "<audience url>",
  "wantAssertionsSigned": false
}
```

This JSON configuration will ensure that Form.io is aware that it should not expect the assertions to be cryptographically signed.

{% hint style="info" %}
For those customers that use private key encryption for SAML responses and/or a private key for decryption, we provide two environment variables which allows you to provide the absolute paths to those key files in your container's file system rather than as plain text string values in the Passport Config JSON object. Those variables are SAML\_PASSPORT\_PRIVATE\_KEY\_PATH and SAML\_PASSPORT\_DECRYPTION\_PVK\_PATH. Alternatively, you can specify the private key and/or the decryption private key as strings in the JSON object.
{% endhint %}

### SAML Passport Generator

Quickly generate the Passport JSON object by utilizing the SAML Passport Generator found within the SAML Settings of the Form.io Project. This generator allows the user to simply input the required endpoints and credentials from the XML data of the SAML provider. The generator will then output the correct JSON structure for the user saving time and relieving potential user error.&#x20;

To access the Passport Generator, navigate to the SAML settings page:

**Settings** > **Authorization** > **SAML** > **Authorization Settings**

{% embed url="<https://www.loom.com/share/446c75a7457448d1847f849ea8fcaee3>" %}

Scroll down to the Passport Configuration of the settings page. Here you can select different SAML Properties required by the SAML provider. Once selected, input the correlated endpoint or settings from the XML file of your SAML provider.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F7tTPXu49YSeWkU2Qhsnp%2Fparameters.jpg?alt=media&#x26;token=45b2c640-b958-4d8e-aa9b-b4b8f511e936" alt=""><figcaption></figcaption></figure>

A full JSON object will be generated and passed to the Passport configuration which will be used to authenticate and authorize SAML users.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FD2SL3YAfnmoyLATmYvUg%2Fpassportjson.jpg?alt=media&#x26;token=f4509434-c01e-4f18-aa5e-ece8d15d3ec7" alt=""><figcaption></figcaption></figure>

### Custom Parser&#x20;

The Custom Parser generates a custom payload for the JWT token based on the SAML Profile object of the authenticating SAML user. This feature opens up additional SAML Profile attributes and claims  within the user object as well as more granular control over SAML/Form.io role mappings.&#x20;

{% hint style="info" %}
The API Server will first check if there is data saved to the "Custom Parser" tab before generating a token. If the Custom Parser is being utilized, then the filled Profile Fields are not taken into account when generating the JWT token.

The Project ID within the payload can not be changed.&#x20;
{% endhint %}

#### Custom Parser Example

This example will include additional profile claims saved to the SAML Profile object as well as the&#x20;

```javascript
user = {
  _id: profile.id,
  data: {
    id: profile.id,
    roles: profile.roles,
    email: profile.email,
    name: 'Joe Smith'
  },
  roles: [
    'ROLE_ID_1',
    'ROLE_ID_2'
  ]
}
```

*Profile* – the data from the SAML profile object.

*Roles* -  These are the IDs of the project roles you would like this user to have when authenticating.

### Test Connection to SAML - Coming Soon <a href="#test-connection-to-saml" id="test-connection-to-saml"></a>

After the XML Metadata or Passport Config is filled in, you can use a test connection to SAML. Сlick on the *"Save SAML Authorization Settings and Connect to SAML"* button, and all unsaved authorization SAML settings will be saved and a new window will open with a test connection to the SAML provider.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FQsZx3vruzwP7afBU6jbp%2Fphoto_2023-10-24_13-47-56.jpg?alt=media&#x26;token=9ae743d0-3f92-4fa8-aff0-7a66f6a34dcc" alt=""><figcaption></figcaption></figure>

After successful authorization, the authorized user's profile object will be available. This will make it easier to fill in the Profile Fields or use Custom Parser.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FY90g3ugyEUExkdsYubHc%2Fphoto_2023-10-24_14-06-33.jpg?alt=media&#x26;token=02472d0c-215f-4607-8fc5-662b97c2d099" alt="" width="563"><figcaption></figcaption></figure>

[^1]: This value is referencing the SAML group parameter configured within the application

[^2]: The ACS URL is an *endpoint on the service provider where the identity provider will redirect to with its* authentication response
