> For AI agents: [llms.txt](https://docs.trustedauth.com/llms.txt) provides a Markdown index of this documentation.

# Jenkins

Jenkins is an open-source automation tool written in Java with plugins built for continuous integration (see <https://www.jenkins.io>). You can protect access to Jenkins by integrating Jenkins with Identity as a Service. Once integrated, users can use single sign-on to log in to their Jenkins account through Identity as a Service.

note

This integration was tested using Identity as a Service version 5.31 and Jenkins Build 2.401.2 LTS. Other versions of Jenkins may require integration and configuration steps that differ from those documented in this procedure. In the event of other issues, contact <support@entrust.com> for assistance.

Before you begin, open two browser windows. In one window, log in to your Jenkins administrator account. In the other window, log in to your IDaaS administrator account.

## Step 1: Download the Service Provider metadata from Jenkins

1. Log in to Jenkins.
2. Click **Manage Jenkins**. The **Manage Jenkins** page appears.
3. Scroll to select **Plugins**. The **Plugins** page appears.
4. Click **Available Plugins**.
5. In the **Plugins** search bar, enter **SAML**.
6. Select to install **SAML**.
7. Select to install **SAML Single Sign On (SSO)**.
8. Click **Install without restart**. The **Download progress** page appears.
9. Select **Restart Jenkins when installation is complete and no jobs are running**.
10. When the installation has finished, log back in to your Jenkins admin account.
11. Click **Manage Jenkins**. The **Manage Jenkins** page appears.
12. Scroll to click **Security**. The **Security** page appears.
13. Under **Security Realm**, select **SAML 2.0**.
14. Scroll to **Service Provider Metadata**.
15. Click **Service Provider Metadata**. The metadata appears.
16. Copy and save the metadata to a file called SPP_Metadata.XML.
17. Return to the **Security** page.
18. Leave this page open. You return to it in _Step 6: Configure Jenkins for Identity as a Service authentication_.

note

This integration was tested using Identity as a Service version 5.31 and Jenkins Build 2.401.2 LTS. Other versions of Jenkins may require integration and configuration steps that differ from those documented in this procedure. In the event of other issues, contact <support@entrust.com> for assistance.

#To integrate Jenkins with Identity as a Service, you must do the following:

Before you begin, open two browser windows. In one window, log in to your Jenkins administrator account. In the other window, log in to your IDaaS administrator account.

### Step 1: Download the Service Provider metadata from Jenkins

Log in to Jenkins.

Click **Manage Jenkins**. The **Manage Jenkins** page appears.

Scroll to select **Plugins**. The **Plugins** page appears.

Click **Available Plugins**.

In the **Plugins** search bar, enter **SAML**.

Select to install **SAML**.

Select to install **SAML Single Sign On (SSO)**.

Click **Install without restart**. The **Download progress** page appears.

Select **Restart Jenkins when installation is complete and no jobs are running**.

When the installation has finished, log back in to your Jenkins admin account.

Click **Manage Jenkins**. The **Manage Jenkins** page appears.

Scroll to click **Security**. The **Security** page appears.

Under **Security Realm**, select **SAML 2.0**.

Scroll to **Service Provider Metadata**.

Click **Service Provider Metadata**. The metadata appears.

Copy and save the metadata to a file called `SPP_Metadata.XML`.

Return to the **Security** page.

Leave this page open. You return to it in _Step 6: Configure Jenkins for Identity as a Service authentication_.

## Step 2: Add Jenkins to Identity as a Service

1. In Identity as a Service, click Menu icon **>** **Security > Applications**. The **Applications** **Lists** page appears.
2. Click **Add**. The **Select an Application Template** page appears.
3. Do one of the following:
   - Select **SAML Cloud Integrations** from the search drop-down list and scroll to find the application you want to add to IDaaS.
   - In the **Search bar**, enter a search option to filter for the application you want to add to IDaaS.
4. Click **Jenkins**. The **Add Jenkins** page appears.
5. Enter an **Application Name**.
6. Enter an **Application Description**.
7. Optional. Add a custom application logo.
   1. Click Plus icon next to **Application Logo**. The **Upload Logo** dialog box appears.
   2. Click Upload icon to select an image file to upload.
   3. Browse to select your file and click **Open**. The **Upload Logo** dialog box reappears showing your selected image.
   4. If required, resize your image.
   5. Click **OK**.
8. Select the **Authentication Flow** that appears to users during login.
9. Click **Next**. The **General** page appears.
10. Click Upload icon to the **Upload Metadata XML** and browse to the location of the metadata file you downloaded. The **Metadata Configuration** dialog box appears.
11. If required, click **Merge with existing values** to merge new values with existing values for Alternative Assertion Consumer Services URLs and SAML attribute names.
12. Click **Save**.
13. Optional. Enter the **SAML Username Parameter Name** used to identity the user ID being requested for authentication. The user ID can then be passed as a parameter, for example, Username=jdoe.
14. Enter the **SAML Session Timeout** to the time when the SAML Assertion times out. The maximum is 720 minutes.
15. Enter the **Max Authentication Age (seconds)** to set the maximum amount of time that can elapse before a user is required to reauthenticate during a new login attempt. This applies for both SP-initiated and IDP-initiated login. Set this field to -1 to disable this feature.
16. Enter the **SAML Session Timeout** to the time when the SAML Assertion times out. The maximum is 720 minutes.
17. From the **SAML NameID Attribute** drop-down list, select **Email**.
18. From the **SAML NameID Encoding Format** drop-down list, select **Email**.
19. From the **SAML Signing Certificate** from the drop-down list, select the Default SAML Signing Certificate.
20. From the **SAML Response Signature Algorithm** drop-down list, select **SHA512**.
21. Select **Sign Complete SAML Response**.
22. Deselect **Enable Go Back Button** if you do not want users to be able to go back to the Jenkins login page to log in.
23. Select **Show Default Assertion Consumer URL Service in the My Profile**. When selected, the Default Assertion Consumer URL appears in a user's My Profile page in addition to relay states and Alternative Assertion Consumer URLs.
24. Optional. Add **Alternative Assertion Consumer Service URLs**, as follows:
    1. Click **Add**.
    2. Enter a **Name**.
    3. Enter a URL **Value**.
    4. Select **Show in My Profile** to display the Alternative Consumer Service URL in a user's My profile page.
    5. Optional. **Add an Application Logo**.
    6. Click **Add**.
    7. Repeat these steps to add more Alternative Assertion Consumer Service URLs.
25. For the IDP initiated login to be successful, you need to set Jenkins SP-Init-SSO. Jenkins can also set up IdP-Init-SSO. IdP-Init-SSO requires IdP to send the Relay State parameter along with the SAML request. You can do this by editing the metadata xml file or setting a Relay state value. Relay states appear on the user's **My Profile** page. Do the following:
    1. Under **Relay State**, click **Add**. The **Add Relay State** dialog box appears.
    2. Enter **Jenkins** in the relay **Name** field.
    3. Enter the **Value** for the relay state. This setting specifies the application or URL that a user is redirected to after successful authentication.
    4. Under **Show in My Profile,** select **Display relay state in user's My Assigned Applications** to display the relay state on the user's My Profile page.

note

After you add relay states, you can also enable or disable them on the Add/Edit application page. Click next to the relay state to disable it or click to re-enable it.

Relay states apply to the Default Assertion Consumer Service URLs and not the Alternative Consumer Service URLs.

26. Click **Submit**.

## Step 3: Add a resource rule

See [Create resource rules](/docs/authentication-and-security/create-and-manage-resource-rules.md).

## Step 4: Download the metadata file from Identity as a Service

1. In Identity as a Service, click Menu icon **>** **Security > Applications**. The **Applications List** page appears.

2. Do one of the following:

   - Click Cloud Download icon next to the application you are integrating with Identity as a Service.
   - Click Ellipsis Vertical icon next to the application you are integrating with Identity as a Service and select **SAML IDP Metadata**.

   The **SAML Application Metadata** dialog box appears.

3. **Select the certificate to include in the SAML IDP Metadata file** from the drop-down list.

4. If applicable, **Select the domain to include in the SAML IDP Metadata** file from the drop-down list.

5. Enter the **Lifetime, in days, for the SAML IDP Metadata file**. The value must be between 2 and 730.

6. Do one of the following, as required:

   - Copy the **Public Endpoint** to paste into your SAML application being used Identity Provider authentication.
   - Click **Download**.

note

If you are using multiple domains, you must download each domain's metadata file separately because the values in the metadata file vary for each domain.

## Step 5: Encode the IDaaS metadata file to Base64

1. Go to <https://www.base64encode.org> (or a similar base64 encoding tool).
2. Set the **Destination Character Set** to **UTF-8**.
3. Copy and paste the SAML metadata your downloaded in _Step 1: Download the metadata file from identity as a Service_.
4. Click **Encode**.
5. Click **Copy to Clipboard** or copy and save the contents to a text file.

## Step 6: Configure Jenkins for Identity as a Service authentication

1. Return to the **Security** page you left open in _Step 1: Download the Service Provider metadata from Jenkins_.
2. Go to **Security Realm** and ensure that **SAML 2.0** is selected. The **IdP Metadata** field appears.
3. Copy and paste the encoded metadata file from _Step 5: Encode the IDaaS metadata file to Base64_ into the **IdP metadata** field.
4. Click **Apply**
5. Click **Validate IdP Metadata**.
6. Click **Save**.

## Step 7: Test the integration

**Testing Service Provider Login**

1. Open a Web browser and enter the URL for your Jenkins account.
2. Enter your username and password and then click **Login**. You are redirected to **Identity as a Service**.
3. Respond to the second-factor authentication challenge. If you respond successfully, you are logged in to Jenkins.

**Testing Identity as a Service redirect log in**

1. Log in to your Identity as a Service account.
2. Go to your **My Profile** page if you are not already there.
3. Under **Applications**, click **Jenkins**.
4. Respond to the second-factor authentication challenge. If you respond successfully, you are logged in to Jenkins.
