Creating a SAML app in Yandex Identity Hub for integration with Jenkins
Jenkins
For your organization's users to be able to authenticate to Jenkins via SAML
SAML apps can be managed by users with the organization-manager.samlApplications.admin role or higher.
Note
For SAML integration, your Jenkins instance must have a valid SSL certificate in place.
To give the users of your organization access to Jenkins:
- Create an app in Yandex Identity Hub.
- Set up the integration.
- Make sure the application works correctly.
Create an app in Yandex Identity Hub
- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Apps. - In the top-right corner, click
Create application and in the window that opens:-
Select the SAML (Security Assertion Markup Language) single sign-on method.
-
In the Name field, specify a name for your new app:
jenkins-saml. -
Optionally, in the Description field, enter a description for the new app.
-
Optionally, add labels:
- Click Add label.
- Specify a label in
key: valueformat. - Press Enter.
-
Click Create application.
-
- Save the Metadata URL value, you will need it at the next step.
Set up the integration
Install the SAML plugin in Jenkins
To configure authentication to Jenkins using SAML, install the SAML plugin:
- Log in to Jenkins as a user with administrator privileges.
- In the left-hand menu, select Manage Jenkins > Plugins.
- Navigate to the Available tab and enter
SAMLin the search bar. - Locate SAML Plugin
and Install it. - Wait for the installation to complete, and restart Jenkins if necessary.
After you install the plugin, a new Security Realm option, SAML 2.0, will appear in the Manage Jenkins > Security section.
Set up the SAML application in Yandex Identity Hub
Set up service provider endpoints
- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Apps and then, the SAML app. - At the top right, click
Edit and in the window that opens:- In the **SP EntityID ** field, enter any value, e.g.,
<jenkins_instance_address>/. - In the ACS URL field, enter
<jenkins_instance_address>/securityRealm/finishLogin. - Optionally, in the SP Logout URL field, enter
<jenkins_instance_address>/securityRealm/finishLogin. - Click Save.
- In the **SP EntityID ** field, enter any value, e.g.,
Configure authentication on the Jenkins side
- Log in to Jenkins as a user with administrator privileges.
- In the left-hand menu, select Manage Jenkins > Security.
- Under Security Realm, select
SAML 2.0. - In the IdP Metadata URL field, enter the metadata file address you copied earlier.
- In the Display Name Attribute field, enter
fullname. - In the Username Attribute field, enter
preferred_username. - In the Email Attribute field, enter
emailaddress. - Enable the Advanced Configuration option. In the SP Entity ID field, enter the value you specified in the **SP EntityID ** field on the Yandex Identity Hub side, e.g.,
<jenkins_instance_address>/. - Click Save.
Configure user attributes
Add the preferred_username attribute to users, which will be used as the username when authenticating to Jenkins. Follow these steps:
-
Log in to Yandex Identity Hub
. -
In the left-hand panel, select
Apps and select the desired app. -
Navigate to the Attributes tab.
-
In the top-right corner, click
Add attribute and in the window that opens:- In the Attribute name field, specify
preferred_username. - In the Value field, select
SubjectClaims.preferred_username. - Click Add.
- In the Attribute name field, specify
For more information about configuring attributes, see Configure user and group attributes.
Add a user
For your organization's users to be able to authenticate to Jenkins with Yandex Identity Hub's SAML app, you need to explicitly add these users and/or user groups to the SAML application.
Note
Users and groups added to a SAML application can be managed by a user with the organization-manager.samlApplications.userAdmin role or higher.
-
Add users to the application:
Cloud Center UI- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Apps and select the required app. - Navigate to the Users and groups tab.
- Click
Add users. - In the window that opens, select the required user or user group.
- Click Add.
- Log in to Yandex Identity Hub
Make sure your application works correctly
To make sure both your SAML app and Jenkins integration work correctly, authenticate to Jenkins as one of the users you added to the app. Follow these steps:
- In your browser, navigate to your Jenkins instance address.
- You will be redirected to the Yandex Cloud authentication page. Specify the email and password for the user you added to the app. The user must also have their email address specified.
- Make sure you have successfully authenticated to Jenkins.