# SonarQube and SAML authentication with OneLogin

**URL:** <https://community.sonarsource.com/t/sonarqube-and-saml-authentication-with-onelogin/35829>\
**Category:** Guides\
**Tags:** authentication, saml\
**Created:** [December 14, 2020, 8:15am UTC](https://community.sonarsource.com/t/sonarqube-and-saml-authentication-with-onelogin/35829 "2020-12-14T08:15:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre\_Frigout](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/alexandre_frigout/32/151_2.png) [@Alexandre\_Frigout](https://community.sonarsource.com/u/Alexandre_Frigout)\
**Post date:** [December 14, 2020, 8:15am UTC](https://community.sonarsource.com/t/sonarqube-and-saml-authentication-with-onelogin/35829/1 "2020-12-14T08:15:46Z")

</div>

Hello!

OneLogin is being used as an identity provider by some SonarQube users.

I wrote this guide so that everybody can have guidance on how to achieve it.

⚠ This guide is set for my own setup, you may need to adjust it to fit your setup/needs.

**1. Create an application in OneLogin**

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/1/0/108296b044f8b3761e463b4c89000c03ffe9f506.png)  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/d/e/de595036c64669654b179199e6875e5922137bb5.png)  
I have chosen _SAML Test Connector_ but you can pick another one if you want.

> ℹ _As of December 2022, the new name for this connector is **SAML Custom Connector** _

**2. Configure general and SAML settings in your Application**

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/9/4/94e42421a7b6f4916e4d38721ae79f31ed0bb4fb.png)  
The _SAML Recipient_ URL must be set as the _sonar.core.serverBaseURL_ with _oauth2/callback/saml_ added.

\ ***3. Check the response parameters**

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/5/f/5fb063db81af59f827cd7e87d8e75e463dfa4801.png)  
The _givenName_, _mail_ and _surname_ must be set so SonarQube can extract them from the response.

**4. Get the Single Sing On information of your application**

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/2/3/2355b964b62cd716828229e38ab6903652853bac.png)  
You need to copy the _Issuer URL_ as well as the _SAML 2.0 Endpoint_ and go to _View details_ at the certificate level then copy the certificate. (it should starts with **-----BEGIN CERTIFICATE-----** )

**5. Configure SonarQube**  
Go to **Administration \> General** then set up the _sonar.core.serverBaseURL_.

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/6/2/62e61b9b2f2b152040ace01601674ed6da22e161.png)

**6. Setup SAML in SonarQube**  
Go to **Administration \> Security \> SAML** and enable SAML.

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/e/d/ed6fef88b2e117b7074cb2c70e714d7c67b33d36.png)  
Make sure to set the **Application ID** with the same value as you have set in OneLogin (step 2)  
Then set the _Provider ID_ (issuer URL), _SAML Login URL_ and _Provider Certificate_ with the values copied in step 4.  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/0/2/0229bcaf147bd43d641ac0fe2b84d5e6e3c4c696.png)  
Finally set the attribute that SonarQube has to find in the response.  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/1/d/1d9a94c831753aec40a079a25a3e897b54f4c8c8.png)  
They must be set as follows,

**SAML user login attribute = urn:oid:2.5.4.42**  
**SAML user name attribute = urn:oid:2.5.4.4**  
**SAML user email attribute = urn:oid:1.3.6.1.4.1.5923.1.1.1.6**

If you want to use groups, you can add a value to the **SAML group attribute** to pass group information.

**7. Login with SAML**

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/6/c/6cb83912b71a0c4f3651d4e222a18cee3d75baaf.png)

If you receive an error while authenticating with SAML, troubleshooting information should be available in the $SONARQUBE\_HOME/logs/web.log file of your instance. The debug logs can bring more information if nothing obvious pops in the INFO logs.

If you run into any trouble or have feedback on this guide, don’t hesitate to create a new post in the Community.

---

<div class="post-metadata">

**Author:** ![Alexandre\_Frigout](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/alexandre_frigout/32/151_2.png) [@Alexandre\_Frigout](https://community.sonarsource.com/u/Alexandre_Frigout)\
**Post date:** [December 14, 2020, 8:16am UTC](https://community.sonarsource.com/t/sonarqube-and-saml-authentication-with-onelogin/35829/2 "2020-12-14T08:16:09Z")

</div>

Closed on December 14, 2020, 8:16am UTC


