# Configuring SAML w/ ADFS for SonarQube

**URL:** <https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129>\
**Category:** SonarQube Server / Community Build\
**Tags:** authentication, saml\
**Created:** [December 14, 2018, 3:18pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129 "2018-12-14T15:18:03Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdkern](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jdkern](https://community.sonarsource.com/u/jdkern)\
**Post date:** [December 14, 2018, 3:18pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/1 "2018-12-14T15:18:03Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):  
_Using SonarQube Enterprise 7.3, SAML 2.0 Authentication for SonarQube 1.1_

We are trying to get SAML configured (using ADFS) on our SonarQube Enterprise instance. We believe we are close to getting it working but have a couple of errors we’re trying to work through.

What is the expected format for the following fields?  
SAML user login attribute  
SAML user name attribute

We are sending these claims:

 ![Active%20Directory](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/7/771c5d7a89bb82d1876caa7a18b4bd0032dea081.jpeg)

We are passing “login” and “Name” to match our claims but are seeing the error below.  
018.12.13 15:46:43 ERROR web[AWeeKRsSggugAZApAB7Y][o.s.s.a.AuthenticationError] Fail to callback authentication with ‘saml’  
java.lang.NullPointerException: Name is missing  
at java.util.Objects.requireNonNull(Objects.java:228)  
at org.sonarsource.auth.saml.SamlIdentityProvider.getNonNullFirstAttribute(SamlIdentityProvider.java:154)  
at org.sonarsource.auth.saml.SamlIdentityProvider.callback(SamlIdentityProvider.java:118)  
at

---

<div class="post-metadata">

**Author:** ![julienlancelot](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julienlancelot/32/68225_2.png) [@julienlancelot](https://community.sonarsource.com/u/julienlancelot)\
**Post date:** [December 18, 2018, 10:37am UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/3 "2018-12-18T10:37:05Z")

</div>

Hi,

How have you configured the name field (sonar.auth.saml.providerName) in SonarQube ?

Regards,  
Julien Lancelot

---

<div class="post-metadata">

**Author:** ![jdkern](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jdkern](https://community.sonarsource.com/u/jdkern)\
**Post date:** [December 18, 2018, 2:45pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/4 "2018-12-18T14:45:32Z")

</div>

We left that as the default “SAML”

---

<div class="post-metadata">

**Author:** ![julienlancelot](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julienlancelot/32/68225_2.png) [@julienlancelot](https://community.sonarsource.com/u/julienlancelot)\
**Post date:** [December 18, 2018, 4:53pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/5 "2018-12-18T16:53:10Z")

</div>

Oups, sorry, I was talking about “sonar.auth.saml.user.name”.

As described in the [documentation](https://docs.sonarqube.org/display/PLUG/SAML+Authentication+Plugin), the sonar.auth.saml.user.XXX parameters must match the SAML attribute.  
Is it the case for you ?

For instance, I think that sonar.auth.saml.user.name should be set to “Name” or “Display-Name”.

---

<div class="post-metadata">

**Author:** ![jdkern](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jdkern](https://community.sonarsource.com/u/jdkern)\
**Post date:** [December 18, 2018, 5:43pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/6 "2018-12-18T17:43:14Z")

</div>

Yes,  
sonar.auth.saml.user.name is set to “Name”  
and  
sonar.auth.saml.user.login is set to “login”

---

<div class="post-metadata">

**Author:** ![julienlancelot](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julienlancelot/32/68225_2.png) [@julienlancelot](https://community.sonarsource.com/u/julienlancelot)\
**Post date:** [December 19, 2018, 8:07am UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/7 "2018-12-19T08:07:27Z")

</div>

Then it means that it’s not these attributes that are sent.

To get the list of SAML attributes that SonarQube is receiving, you need to :

- Change the web log to TRACE
- Authenticate with any user
- Search in logs/web.log for log starting with " Attributes received :"

Regards.,  
Julien Lancelot

---

<div class="post-metadata">

**Author:** ![jdkern](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jdkern](https://community.sonarsource.com/u/jdkern)\
**Post date:** [December 19, 2018, 2:55pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/8 "2018-12-19T14:55:27Z")

</div>

Thanks so much! Based on tracing it was expected this:  
“[http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name](http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name)” instead of “Name” which seems a bit crazy but it is working now 🙂

---

<div class="post-metadata">

**Author:** ![jdkern](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jdkern](https://community.sonarsource.com/u/jdkern)\
**Post date:** [December 19, 2018, 7:20pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/9 "2018-12-19T19:20:05Z")

</div>

One more question – we’d really like to get this working with SSO (and not have to click the login button to authenticate with SAML). From my preliminary googling the only way to make SSO work with SonarQube is via advanced nginx config (at which point one would be bypassing the SAML plugin essentially). Is there an alternative way to do this? Perhaps by pointing at the login url directly or setting up redirects? Any documentation around such an approach would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![julienlancelot](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julienlancelot/32/68225_2.png) [@julienlancelot](https://community.sonarsource.com/u/julienlancelot)\
**Post date:** [December 20, 2018, 8:13am UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/10 "2018-12-20T08:13:54Z")

</div>

I’m happy that you’ve been able to solve your issue !

About the fact users still need to click on the “SAML” button to authenticate on SonarQube, it won’t be possible as to change that when using SAML authentication.

What you can do is to use the HTTP headers authentication, you’ll find more info here : [https://docs.sonarqube.org/latest/instance-administration/delegated-auth/](https://docs.sonarqube.org/latest/instance-administration/delegated-auth/)

Regards,  
Julien Lancelot

---

<div class="post-metadata">

**Author:** ![wlt](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@wlt](https://community.sonarsource.com/u/wlt)\
**Post date:** [March 6, 2019, 7:24am UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/11 "2019-03-06T07:24:05Z")

</div>

Hi Josh,

May i know what key you put instead of Name?

Currently the link you shared is no longer accessible.

Thanks !!

---

<div class="post-metadata">

**Author:** ![jdkern](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jdkern](https://community.sonarsource.com/u/jdkern)\
**Post date:** [March 27, 2019, 4:49pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/12 "2019-03-27T16:49:28Z")

</div>

It wasn’t a link actually (or it wasn’t supposed to be). The actual string I put started with “http://”…

---

<div class="post-metadata">

**Author:** ![agourav1989](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/agourav1989/32/33793_2.png) [@agourav1989](https://community.sonarsource.com/u/agourav1989)\
**Post date:** [March 28, 2019, 11:24am UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/13 "2019-03-28T11:24:02Z")

</div>

Can anyone please confirm what exactly needs to be given in below two fileds of SAML configuration -  
sonar.auth.saml.user.login  
sonar.auth.saml.user.name

---

<div class="post-metadata">

**Author:** ![nirmitpatel](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@nirmitpatel](https://community.sonarsource.com/u/nirmitpatel)\
**Post date:** [June 7, 2019, 7:13pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/14 "2019-06-07T19:13:41Z")

</div>

Hi Josh,

Glad to know that SAML with ADFS is working for you. Can you please share the configuration if possible? Basically, looking for below configuration details -

Identifier Name  
Endpoint  
Claims - This one I believe is the screenshot you have shared above.

Thank you in advance!

- Nirmit

---

<div class="post-metadata">

**Author:** ![Joe](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/joe/32/14820_2.png) [@Joe](https://community.sonarsource.com/u/Joe)\
**Post date:** [January 15, 2021, 9:19pm UTC](https://community.sonarsource.com/t/configuring-saml-w-adfs-for-sonarqube/5129/15 "2021-01-15T21:19:05Z")

</div>

@jdkern: can you try hitting **\<SONARQUBE\_HOST\_URL\>/sessions/init/saml?return\_to=%2F** URL directly and see if this works for you?
