SAML Single Sign On (SSO) into SonarQube using PingFederate
SonarQube SAML plugin gives the ability to enable SAML Single Sign On for the SonarQube. Here we will go through a guide to configure SSO between SonarQube and PingFederate. By the end of this guide, PingFederate users should be able to log in and register to the SonarQube Server.
You can refer the steps from the video or documentation below to configure your IDP with SonarQube.
Step 1: Setup PingFederate as Identity Provider
All the information required to configure the Ping Federate as SAML IDP i.e. plugin’s metadata is given in the Service Provider Info tab of the miniOrange plugin.
Login to your Ping Federate user admin dashboard.
Click on the Identity Provider in the left navigation menu.
Under SP CONNECTION, click on Create New button.
Select the Browser SSO Profiles connection template on the Connection Type tab and click Next.
Select Browser SSO on the Connection Options tab and click Next.
Select File as the method for importing metadata and click Choose File to choose the miniOrange SSO plugin’s metadata on the Import Metadata tab or you can add SP Metadata information manually by selecting the None Option. You will need to copy SP Entity ID, SP ACS URL, and Certificate from Service Provider Tab.
Review the information on the Metadata Summary tab and click Next.
In the General Info tab ensure that the Service Provider’s Entity ID, Connection Name, and Base URL fields pre-populate based on the metadata. Click Next.
Navigate to the Browser SSO tab and click on the Configure Browser SSO. You will be redirected to Browser SSO Setup wizard.
1) Select the IdP-Initiated SSO and SP-Initiated SSO options on the SAML Profiles tab and click Next.
2) Enter your desired assertion validity time from on the Assertion Lifetime tab and click Next. By default, it is configured 5 minutes for both.
3) Navigate to the Assertion Creation and click on the Configure Assertion Creation. You will be redirected to the assertion creation setup wizard.
I. In the Identity Mapping tab select STANDARD and click Next.
II. Select a Subject Name Format for the SAML_SUBJECT on the Attribute Contract tab and click Next.
III. Click Map New Adapter Instance on the Authentication Source Mapping.
IV. Select an Adapter Instance and click Next. The adapter must include the user’s email address.
V. Select the Use only the adapter contract values in the SAML assertion option on the Mapping Method tab and click Next.
VI. Select your adapter instance as the Source and the email as the Value on the Attribute Contract Fulfilment tab and click Next.
VII. (Optional) Select any authorization conditions you would like on the Issuance Criteria tab and click Next.
VIII. Click Done on the Summary.
IX. Click Next on the Authentication Source Mapping tab.
X. Click Done on the Summary tab.
XI. Click Next on the Assertion Creation
Navigate to the Protocol Settings tab of the Browser SSO wizard and click on the Configure Protocol settings.
1) Select POST for Binding and specify the single sign-on endpoint URL in the Endpoint URL field on the Assertion Consumer Service URL. Click Next.
2) Select POST on the Allowable SAML Bindings tab and click Next.
3) Select your desired signature policies for assertions on the Signature Policy tab and click Next.
4) Select your desired encryption policy for assertions on the Encryption Policy tab and click Next.
5) Click Done on the Protocol Settings Summary tab.
6) Click Done on the Browser SSO Summary.
Navigate to the Credentials and click on the Configure Credentials. You will be redirected to the Credentials setup wizard.
1) Select the Signing Certificate to use with the Single Sign-On service and select Include the certificate in the signature element in the Digital Signature Settings tab. Click Done.
2) Click Done on the Summary.
3) Click Next on the Credentials.
Select Active for the Connection Status on the Activation & Summary tab and click Save.
Now, navigate to the Ping Federate User Admin dashboard Identity Provider.
Click Manage All under SP Connections.
Click Export Metadata for the desired service provider connection.
Click Export on the Export & Summary tab and click Done.
Step 2: Configure SonarQube as Service Provider.
Fetch the Identity Provider (IdP) Details
After configuring the IdP, get its metadata to configure SonarQube as a Service Provider(SP)
Copy the following details from the IdP metadata and paste them into the corresponding text fields in the SonarQube plugin
1. IdP Entity ID
2. Login URL
3. X.509 Certificate
Save all the details.
Once you have filled all the IdP details, go to Administration >>Configuration >>miniOrange SAML Support and then click on the Test Configuration tab.
It will show you the IdP login page. Enter your IdP credentials and log in.
If all the configurations are correct, it will show you the user details received from the IdP.
If the test fails, check if you have missed out any steps or try to debug through SonarQube Logs.
To be able to troubleshoot through logs, first you'll have to set a higher log level in your SonarQube application.
To do so, go to the SonarQube Dashboard >>Administration >>System.
Under the system settings, you'll find an option to change the log's level. Select DEBUG and save it. Now try to configure the plugin.
If you face any problem during configuration, go to %SONARQUBE_HOME% / logs directory.
Find and open the web.log file. Go through the logs recorded.
You'll find the stacktrace of performed actions, along with date and time information.