Creating a SAML app in Yandex Identity Hub for integration with SonarQube
Note
This feature is at the Preview stage.
SonarQube
To authenticate your organization's users to SonarQube via SAML
SAML apps can be managed by users with the organization-manager.samlApplications.admin role or higher.
For the users of your organization to be able to access SonarQube:
Create an app
- 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:
sonarqube-app. - Optionally, in the Description field, enter a description for the new app.
- Optionally, add labels:
- Click Add label.
- Enter a label in
key: valueformat. - Press Enter.
- Click Create application.
Set up the integration
Note
SAML integration is supported for SonarQube Developer Edition and higher.
To integrate SonarQube with the SAML app you created in Identity Hub, complete the configuration both on the SonarQube side and in Identity Hub.
Set up the SAML app in SonarQube
Note
To set up the SAML app in SonarQube, the user needs the Administer System global permission.
- To configure SAML authentication in SonarQube, in the left-hand panel, navigate to Administration and then, in the menu that opens, go to Configuration -> General Settings. In the General Settings menu, select Authentication -> SAML.
- Click Create configuration.
Then complete the steps below:
Connect SonarQube to the IdP
Configure a link between SonarQube and Identity Hub:
- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Apps and then, the SAML app. - In the Overview tab, under Identity provider (IdP) configuration, copy the Issuer / IdP EntityID and Login URL field values.
- On the Overview tab, under Application certificate, click Download certificate and save the file to your device.
- Go back to SonarQube, then in the Edit SAML configuration menu:
- In the Application ID field, leave the default value,
sonarqube. - Paste the copied values into the Provider ID and SAML login url fields.
- Open the saved certificate file in any text editor, copy its contents and paste it into the Identity provider certificate field.
- In the Application ID field, leave the default value,
Map user attributes
Set up mapping between user object fields in SonarQube and Identity Hub:
- In the SAML user login attribute field, specify
login. - In the SAML user name attribute field, specify
fullname. - Optionally, in the SAML user email attribute field, specify
emailaddress. - If you want SonarQube users to get assigned to one of the groups when they log in, add the user group attribute. To do this, specify
groupsunder SAML group attribute. - Save the settings by clicking Save configuration.
- Click Enable configuration.
Set the public URL
In the General Settings menu, from the Authentication section, go to General. Under General, in the Server base URL field, enter https://<your-domain>.
Map user groups
Note
If you do not configure group mapping, all users will be assigned to the default sonar-users group when they log in.
You can set up which group to assign users to upon login. To do this, you need to create groups on the SonarQube side:
- At the top of the page, from the Configuration section, go to Security -> Groups.
- Click Create Group.
- In the Name field, enter a name for the group, e.g.,
test-group. You will need to create the group when setting up the app in Identity Hub. - Click Create.
- To configure permissions for the group:
- In the Security menu, go from the Groups section to the Global Permissions section.
- To the right of the
test-group, check the required permissions.
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. - In the top-right corner, click
Edit and in the window that opens:- Set the **SP EntityID ** field value to
sonarqube. - In the ACS URL field, enter this address:
https://<your-domain>/oauth2/callback/saml. - Click Save.
- Set the **SP EntityID ** field value to
Configure user attributes
Warning
For integration with SonarQube, users must have the login attribute.
If users do not have the login attribute, add it:
- 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, enter
login. - In the Value field, select
SubjectClaims.preferred_username. - Click Add.
- In the Attribute name field, enter
If you have configured user group mapping in SonarQube, add the user group attribute. To do this:
- In the top-right corner, click
Add group attribute and in the window that opens:- In the Attribute name field, specify
groups. - In the Transmitted groups field, select
Assigned groups only. - Click Add.
- In the Attribute name field, specify
For more information about configuring attributes, see Configure user and group attributes.
Add users
For your organization's users to be able to authenticate in SonarQube with Identity Hub's SAML app, you need to explicitly add these users and/or user groups to your SAML app.
Note
Users and groups added to a SAML application can be managed by a user with the organization-manager.samlApplications.userAdmin role or higher.
-
If you have configured user group mapping on the SonarQube side, create the required group:
Cloud Center UI- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Groups. - In the top-right corner of the page, click
Create group. - Enter the name:
test-group. - Click Create group.
- Add users to the group:
- Navigate to the Members tab.
- Click Add member.
- In the window that opens, select the required users.
- Click Save.
- Log in to Yandex Identity Hub
-
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 ensure that your SAML app and integration with SonarQube are working correctly, authenticate to SonarQube as one of the users you added to the app. To do this:
- In your browser, navigate to the address of your SonarQube instance, e.g.,
https://<your-domain>. - If you were logged in to SonarQube, log out.
- On the SonarQube authentication page, click Log in with SAML.
- On the Yandex Cloud authentication page, enter your email address and user password. The user or group they belong to must be added to the application.
- Make sure you are logged in to SonarQube.
- If you have configured role mapping, go to the user profile in SonarQube and make sure the appropriate group is displayed under Groups.