Creating an OIDC application in Yandex Identity Hub for integration with Jenkins
Jenkins
For the users of your organization to be able to authenticate to Jenkins via OpenID Connect SSO, create an OIDC app 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 access to Jenkins to the users of your organization:
- 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 Application type field, select Web Application.
OIDC apps of the
Web Applicationtype are optimized for user authentication to external web apps with a server end (backend), where the application secret can be safely stored. For more information about OIDC application types, see Types of OIDC apps in Yandex Identity Hub. -
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.
- Add 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:
Create an app secret (only available for applications of the
Web Applicationtype):-
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 required.
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 select 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
Tip
If you want to fine-tune user authentication in your applications, including authentication only from specific IP addresses, use authentication policies.
Authentication policies are a Yandex Identity Hub tool that allows you to flexibly configure access to applications by denying or allowing authentication for specific users in specific applications and/or from specific IP addresses. For more information, see Authentication policies in 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. Proceed as follows:
- 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.