Creating an OIDC application in Yandex Identity Hub for integration with Jenkins
Jenkins
For your organization's users to be able to authenticate to Jenkins via OpenID Connect SSO, create an OIDC app in Yandex Identity Hub and configure it both in Yandex Identity Hub and Jenkins.
OIDC apps can be managed by users with the organization-manager.oauthApplications.admin role or higher.
Note
For OIDC integration, your Jenkins instance must have a public domain and 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 OIDC (OpenID Connect) single sign-on method.
-
In the Name field, specify a name for your new app:
jenkins-oidc. -
In the Folder field, select the folder where you want to create an OAuth client for your app.
-
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.
-
-
On the Overview tab of the window that opens, copy under Identity provider (IdP) configuration and save the
ClientIDandOpenID Configurationvalues. -
Create an app secret:
Under App secrets, click Add secret, and in the window that opens:
- Optionally, add a description for the new secret.
- Click Create.
The window will display the generated application secret. Save this value.
Warning
If you refresh or close the application information page, you will not be able to view the secret again.
If you closed or refreshed the page before saving the secret, click Add secret to create a new one.
To delete a secret, in the list of secrets on the OIDC app page, click
in the secret row and select Delete.
Set up the integration
Install the OIDC plugin in Jenkins
To configure authentication to Jenkins using OIDC, install the OIDC 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
OpenId Connect Authenticationin the search bar. - Find OpenId Connect Authentication
and click Install. - Wait for the installation to complete, and restart Jenkins if necessary.
After installing the plugin, a new Security Realm option, Login with Openid Connect, will appear under Manage Jenkins > Security.
Configure your OIDC application in Yandex Identity Hub
Configure the redirect URI
- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Apps and then, the OIDC app. - At the top right, click
Edit and in the window that opens:- In the Redirect URI field, specify the authentication endpoint for your test application:
<jenkins_instance_address>/securityRealm/finishLogin. - Click Save.
- In the Redirect URI field, specify the authentication endpoint for your test application:
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
Login with Openid Connect. - In the Client id field, enter the value you copied from the ClientID field when setting up the OIDC application in Yandex Identity Hub.
- In the Client secret field, enter the value you copied from the App secrets section when setting up the OIDC application in Yandex Identity Hub.
- In the Well-known configuration endpoint field, enter the URL you copied from the OpenID Configuration field when setting up the OIDC application in Yandex Identity Hub.
- Click Advanced and enter
openid email profilein the Override scopes field. - Click User fields and fill in the fields as follows:
- User name field name:
preferred_username - Full name field name:
name - Email field name:
email
- User name field name:
- Click Save.
Add a user
For your organization's users to be able to authenticate in Jenkins with Yandex Identity Hub's OIDC app, you need to explicitly add these users and/or user groups to the OIDC application.
Note
Users and groups added to an OIDC application can be managed by a user with the organization-manager.oidcApplications.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 OIDC 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.