SAML Single Sign On (SSO) into SonarQube using KeyClock


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 KeyClock. By the end of this guide, KeyClock users should be able to log in and register to the SonarQube Server.


Pre-requisites

You'll require SP metadata for IDP configuration.
You can find it under Administration >>Configuration >>miniOrange SAML Support >> SP Metadata tab.
The SP metadata can be used manually or using 2 Different Format options Text or File.


sonarqube-saml-single-sign-on-sso-plugin-sp-metadata-different-format

You can refer the steps from the video or documentation below to configure your IDP with SonarQube.

Steps to configure Keycloak Login using Keycloak as IDP

Select Keycloak version:

1. Setup Keycloak as IdP (Identity Provider)

 Keycloak Single Sign-On | miniorange img Configure Keycloak as IdP
  • In your Keycloak Admin console, select the realm that you want to use.
  • Click on Clients from the left menu and then click on Create button to create a new client/application.
  •  Keycloak Single Sign-On | Creating an APP
  • Enter SP-EntityID / Issuer as the Client ID from the "Service Provider Metadata" Tab and select SAML as the Client Protocol.
  • Keycloak  SSO | Add Client
  • Now click on Save.
  • Configure Keycloak by providing the required details:
  • Client ID The SP-EntityID / Issuer from the plugin's Service Provider Metadata tab
    Name Provide a name for this client
    Description Provide a description
    Client Signature Required OFF
    Force POST Binding OFF
    Force Name ID Format OFF
    Name ID Format Email
    Root URL Leave empty or Provide Base URL from Service Provider Metadata tab
    Valid Redirect URIs The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
     Keycloak Single Sign-On | Settings  Keycloak Login | Settings
  • Under Fine Grain SAML Endpoint Configuration, Enter the following details:
  • Assertion Consumer Service POST Binding URL The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Logout Service Redirect Binding URL (Optional) The Single Logout URL from the plugin's Service Provider Metadata tab
     Keycloak Single Sign-On | SAML Endpoint Configuration
  • Click on Save.
  • In the plugin, navigate to SP Information tab. Here, you can find the SP metadata such as SP Entity ID and ACS (AssertionConsumerService) URL which are required to configure the keycloak as IdP (Identity Provider).
  • Keycloak  SSO |  Saml Upload Metadata
  • In your Keycloak Admin console, select the realm that you want to use.
  • Click on Clients from the left menu and then click on Create Client button to create a new client/application.
  • Keycloak  SSO | Creating an APP
  • Select SAML as Client type, Enter SP-EntityID / Issuer as the Client ID from the "Service Provider Metadata" Tab,Enter Name of your application and enter Description.
  • Keycloak  SSO | Add Client
  • Now click on Save.
  • Configure Keycloak by providing the required details:
  • Client ID The SP-EntityID / Issuer from the plugin's Service Provider Metadata tab
    Name Provide a name for this client
    Description Provide a description
    Client Signature Required OFF
    Force POST Binding OFF
    Force Name ID Format OFF
    Name ID Format Email
    Root URL Leave empty or Provide Base URL from Service Provider Metadata tab
    Valid Redirect URIs The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
     Keycloak Single Sign-On | Keycloak Login - Settings Keycloak  SSO | Keycloak Login - Settings  Keycloak Single Sign-On | Keycloak Login - Settings
  • Now click on Save.
  • In Advanced tab,under Fine Grain SAML Endpoint Configuration, Enter the following details:
  • Assertion Consumer Service POST Binding URL The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Logout Service Redirect Binding URL (Optional) The Single Logout URL from the plugin's Service Provider Metadata tab
     Keycloak Login | Login SAML Endpoint Configuration
  • Click on Save.
  • In your Keycloak Admin console, select the realm that you want to use.
  • Click on Clients from the left menu and then click on Create Client button to create a new client/application.
  • Keycloak  SSO | Creating an APP / Client
  • Select SAML as Client type, Enter SP-EntityID / Issuer as the Client ID from the Service Provider Metadata tab, enter Name of your application and enter Description.
  • Keycloak  SSO | Add Client in Keycloak IDP
  • Click on the Next button.
  • Provide the details as mentioned below:
  • Root URL Leave empty or provide Base URL from Service Provider Metadata tab
    Valid Redirect URIs The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
  • Click on Save button.
  •  Keycloak Single Sign-On | Provide details in Keycloak IDP
  • In the Settings tab under SAML capabilities section, configure Keycloak by providing the required details:
  • Force POST Binding OFF
    Force Name ID Format OFF
    Name ID Format Email
    Keycloak  SSO | Keycloak Login - Settings tab configuration
  • In the Keys tab, disable the Client signature required toggle.
  • Keycloak  SSO | Disable Client signature required
  • Click on the Save button.
  • In Advanced tab, under Fine Grain SAML Endpoint Configuration, enter the following details:
  • Assertion Consumer Service POST Binding URL The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Logout Service Redirect Binding URL (Optional) The Single Logout URL from the plugin's Service Provider Metadata tab
    Keycloak  SSO | Advanced tab configuration
  • Click on Save button.

miniorange img  Add Mappers

  • Navigate to Mappers tab and click on Add Builtin button.
  • Keycloak  SSO | Mappers Tab
  • Select the checkboxes of X500 givenName, X500 surname and X500 email attributes.
  •  Keycloak Login | Add built-in protocol mapper
  • Click on Add Selected button. You will see the mappings that are added below.
  •  Keycloak Single Sign-On |  Add Selected
  • In Client scopes tab,click on your application.
  • Keycloak  SSO | click on application
  • Click on Add predefined mapper.  Keycloak Single Sign-On | Add predefined mapper
  • Select the checkboxes of X500 givenName, X500 surname and X500 email attributes.
  • Keycloak  SSO | select checkboxes
  • Click on Add button.
  • You will see the mappings that are added below.
  •  Keycloak Single Sign-On | mappings
  • In the Client scopes tab, click on your application.
  • Keycloak  SSO | Client scopes
  • Click on Add predefined mapper.
  • Keycloak  SSO | Add predefined mapper
  • Select the checkboxes of X500 givenName, X500 surname and X500 email attributes.
  • Keycloak  SSO | Select the checkboxes
  • Click on the Add button.
  • You will see the mappings that are added below.
  • Keycloak  SSO | See the mappings

miniorange img Download setup file

  • Navigate to Realm Settings, click on SAML 2.0 Identity Provider Metadata mentioned as Endpoints in the General Tab.
  • Keycloak  SSO | configure Settings
  • Note the URL and keep it handy. That will provide you with the Endpoints required to configure the plugin.
  • You have successfully configured Keycloak as SAML IdP ( Identity Provider) for achieving Kecloak SSO, ensuring secure Login into (WP) Site.

  • Navigate to Realm Settings, click on SAML 2.0 Identity Provider Metadata mentioned as Endpoints in the General Tab.
  •  Keycloak Login | configure settings
  • Note the URL and keep it handy. That will provide you with the Endpoints required to configure the plugin.
  • You have successfully configured Keycloak as SAML IdP ( Identity Provider) for achieving Keycloak login / Keycloak SSO / Keycloak Single Sign-On (SSO), ensuring secure Login into (WP) Site.

  • Navigate to Realm Settings, click on SAML 2.0 Identity Provider Metadata mentioned as Endpoints in the General tab.
  •  Keycloak Login | Realm settings endpoints
  • Note the URL and keep it handy. That will provide you with the Endpoints required to configure the plugin.

Step 2: Configure SonarQube as Service Provider.

    miniorange img 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. 1. IdP Entity ID
        2. Login URL
        3. X.509 Certificate

    • Save all the details.
    • sonarqube saml single sign on (sso) plugin - idp_details

    miniorange img  Test Configuration

    • 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.
      sonarqube saml single sign on (sso) plugin - test_configuration

    miniorange img  Attribute & Group Mapping

    • In order to map attributes from the Identity Provider to the application, the attribute names received in the SAML response need to be entered in their corresponding fields.
    • To view these attribute names, click on the Test Configuration tab in the plugin support page.
    • Attributes used in SonarQube Application are described briefly as below:
  1. Login Attribute is a unique name assigned to the user to identify them uniquely within the SonarQube system. It's a required attribute.

  2. Name Attribute is the full name of the user, to be mapped from the IdP to the SonarQube. It's a required attribute.

  3. Email Attribute is an optional attribute and represents an email address of the user, to be mapped from the IdP to the SonarQube.

  4. Group Attribute mapping requires the group names, in the application, to be same as the group names in the Identity Provider. Otherwise, the default SonarQube Group is assigned to the user.
    • Eg. To map group value Everyone from SAML response we have to paste groupName in Group Attribute field [Refer with above image].
    • sonarqube saml single sign on (sso) plugin - attribute_mapping



Free Trial

If you don't find what you are looking for, please contact us at support-atlassian@miniorange.atlassian.net or raise a support ticket here.