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.
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.
1. In Identity as a Service, click
> 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.
- or -
● 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.
a. Click next to Application Logo. The
Upload Logo dialog box appears.
b. Click to
select an image file to upload.
c. Browse to select your file and click Open. The Upload Logo dialog box reappears showing your selected image.
d. If required, resize your image.
e. Click OK.
8. Select the Authentication Flow that appears to users during login.
9. Click Next. The General page appears.
10. Click
to the Upload Metadata XML
and browse to the location of the metadata file you downloaded
in Step 1: Download the Service Provider metadata
from Jenkins. The Metadata Configuration
dialog box appears.
a. If required, click Merge with existing values to merge new values with existing values for Alternative Assertion Consumer Services URLs and SAML attribute names.
b. Click Save.
11. 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.
12. Enter the SAML Session Timeout to the time when the SAML Assertion times out. The maximum is 720 minutes.
13. 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.
14. Enter the SAML Session Timeout to the time when the SAML Assertion times out. The maximum is 720 minutes.
15. From the SAML NameID Attribute drop-down list, select Email.
16. From the SAML NameID Encoding Format drop-down list, select Email.
17. From the SAML Signing Certificate from the drop-down list, select the Default SAML Signing Certificate.
18. From the SAML Response Signature Algorithm drop-down list, select SHA512.
19. Select Sign Complete SAML Response.
20. 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.
21. 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.
22. Optional. Add Alternative Assertion Consumer Service URLs, as follows:
a. Click Add.
b. Enter a Name.
c. Enter a URL Value.
d. Select Show in My Profile to display the Alternative Consumer Service URL in a user's My profile page.
e. Optional. Add an Application Logo.
f. Click Add.
g. Repeat these steps to add more Alternative Assertion Consumer Service URLs.
23. 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:
a. Under Relay State, click Add. The Add Relay State dialog box appears.
b. Enter Jenkins in the relay Name field.
c. Enter the Value for the relay state. This setting specifies the application or URL that a user is redirected to after successful authentication.
d. 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.
Notes: 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.
24. Click Submit.
Download the Metadata file from Identity as a Service
1. In Identity as a Service, click
> Security > Applications.
The Applications List page appears.
2. Do one of the following:
● Click
next to the application you are integrating
with Identity as a Service.
–or–
● Click
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:
a. Copy the Public Endpoint to paste into your SAML application being used Identity Provider authentication.
b. 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.
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.
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.
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.