SAML, LDAP, OIDC/SSO, Proxies, TLS, and Network Security: Core Concepts and Mental Model
Separate external identity trust, reverse-proxy/TLS state, SonarQube authentication, group synchronization, and SonarQube authorization into independently testable security boundaries.
Learning objectives
- Separate the browser/client, reverse proxy, TLS certificate, SonarQube web process, identity provider, group synchronization, and SonarQube permission model.
- Explain why authentication proves identity while authorization remains owned by SonarQube permissions and permission templates.
- Describe current Community Build support for LDAP and SAML without assuming generic OIDC is a native built-in authentication method.
-
Explain the purpose of Server base URL,
X-Forwarded-Proto,X-Forwarded-For, Host preservation, callback URLs, and client trust stores. - Design a local recovery path before changing external authentication.
- Preserve network/authentication evidence without exposing IdP secrets, private keys, session cookies, or scanner tokens.
1. The practical problem: SSO, TLS, and authorization fail in different places
Chapter 21 established the identity-to-permission model: authentication tells SonarQube who an actor is, while groups and permissions decide what that actor may do. Chapter 22 adds the network and delegated-authentication boundaries around that model.
When an SSO login fails, the cause can be a browser-to-proxy TLS problem, a wrong external base URL, a missing forwarded header, an IdP callback mismatch, an invalid SAML certificate, an LDAP bind/trust failure, a group-claim mismatch, or a perfectly authenticated user who simply lacks SonarQube permission. Treating all of those as “SSO is broken” produces dangerous troubleshooting shortcuts.
client → TLS/reverse proxy → SonarQube web endpoint → delegated
identity provider → authenticated identity → synchronized/local
groups → SonarQube permissions → allowed action
2. Mental model: six trust boundaries, not one login screen
flowchart TD C[Browser / Scanner / IDE] -->|HTTPS| P[Controlled reverse proxy] P -->|HTTP on trusted hop| S[SonarQube web process] S -->|LDAP / SAML / supported provider| I[Identity provider] I -->|identity + optional groups| S S --> A[Authenticated SonarQube user] A --> G[Groups / JIT synchronization] G --> R[Global + project permissions] R --> O[UI / API / scanner action]
The proxy terminates transport security. The IdP proves identity. SonarQube persists the user identity and, when configured, synchronizes group membership. SonarQube permissions then authorize actions. A successful TLS handshake says nothing about group mapping, and a successful SAML assertion says nothing about Administer System permission.
3. Current authentication support: verify the built-in list before choosing a protocol
As of the 2026-09-08 course baseline, current Community Build documentation lists these delegated authentication methods: HTTP header, LDAP, SAML, GitHub, Bitbucket Cloud, and GitLab. LDAP and SAML are therefore valid Community Build learning paths.
| Method | Current Community Build status | Important boundary |
|---|---|---|
| LDAP / Active Directory LDAP | Built in | Configured through system properties; LDAP/LDAPS trust and group mapping must be validated. |
| SAML 2.0 | Built in | Service-provider-initiated SAML; correct external base URL and reverse-proxy headers are critical. |
| HTTP header authentication | Built in | The upstream proxy/authenticator becomes a high-trust component; SonarQube must not accept spoofable identity headers from arbitrary clients. |
| GitHub / GitLab / Bitbucket Cloud auth | Built in | Provider-specific app/token trust model; Chapter 18 covered those provider identities. |
| Generic OIDC | Not listed as a native method in the current Community Build authentication overview | Use a supported native method such as SAML, or treat a third-party OIDC plugin as an explicit plugin/compatibility decision. |
4. SonarQube inbound TLS model: HTTPS ends at a reverse proxy
Current SonarQube documentation states that the application accepts plain HTTP for inbound traffic. Production HTTPS is therefore normally implemented by a reverse proxy, ingress controller, load balancer, or equivalent trusted edge that terminates TLS and forwards HTTP to SonarQube.
browser https://sonarqube.example → TLS certificate at proxy →
proxy HTTP → SonarQube :9000
Restrict the backend SonarQube port so ordinary clients cannot bypass the proxy. On a single host, binding the SonarQube web listener to loopback or firewalling port 9000 to the proxy is materially safer than exposing both HTTPS and raw HTTP paths.
5. Forwarded headers: transport facts must come from a trusted proxy
For HTTPS and SAML, current documentation requires the proxy to set:
-
X-Forwarded-Proto— typicallyhttps. X-Forwarded-For— the client address chain.
The proxy should also preserve the intended Host value. SonarSource
additionally documents Sonar-MD5, used by scanners to
validate downloaded plugins, as a header that must not be
accidentally stripped when analyses pass through the proxy.
6. Server base URL: external identity of the SonarQube instance
The Server base URL is the canonical external URL that SonarQube uses for authentication/integration links. Current Community Build documentation says it must be configured or authentication/integration features may not work correctly.
Internal backend: http://127.0.0.1:9000
External/base URL: https://sonarqube.example.test
SAML Reply/ACS URL: https://sonarqube.example.test/oauth2/callback/saml
The callback URL belongs to the externally visible origin—not the internal backend URL. A mismatch among browser URL, proxy Host/proto, Server base URL, and IdP callback registration is a classic redirect-loop or assertion-recipient failure.
7. SAML: browser-mediated trust with signed assertions
SonarQube Community Build currently supports SAML 2.0 using a service-provider-initiated flow. SonarQube sends the browser to the IdP; the IdP authenticates the user and returns a signed SAML response/assertion; SonarQube validates that assertion using the configured IdP certificate and maps identity attributes.
| State to record | Why it matters |
|---|---|
| Application / entity ID | Must match IdP configuration. |
| IdP login URL and provider ID | Defines the trust endpoint and issuer identity. |
| IdP X.509 certificate | Validates SAML signatures; expiry/rotation is an operational event. |
| User login/name/email attributes | Determine SonarQube user identity mapping. |
| Group attribute | Controls JIT group synchronization when enabled. |
| External base/callback URL | Must align with reverse proxy and IdP registration. |
Do not remove local recovery access merely because a SAML test succeeds once. Test multiple representative users/groups and preserve a rollback path before enforcing delegated login operationally.
8. LDAP: bind/search/group synchronization is a different protocol model
LDAP authentication is configured through SonarQube system properties. Current Community Build can validate user passwords against LDAP/Active Directory LDAP and optionally synchronize group membership at login. LDAPS introduces Java trust-store requirements: the LDAP server certificate must be trusted by the SonarQube Java runtime.
# Illustrative fake/local configuration only
sonar.security.realm=LDAP
ldap.url=ldaps://ldap.example.invalid:636
ldap.bindDn=cn=sonarqube-reader,ou=svc,dc=example,dc=invalid
ldap.bindPassword=<secret from runtime configuration, not Git>
ldap.user.baseDn=ou=people,dc=example,dc=invalid
ldap.group.baseDn=ou=groups,dc=example,dc=invalid
Simple LDAP authentication over unencrypted ldap:// is
not appropriate for production credentials. Use LDAPS or another
approved secure LDAP mechanism and validate certificate identity
instead of disabling verification.
9. Group synchronization changes the owner of membership state
With JIT group synchronization, the delegated identity source supplies group membership at login, while the SonarQube groups themselves must exist and hold the intended permissions. Once external group synchronization owns a user’s membership, manual membership edits are not a durable source of truth.
sonar-administrators without a narrowly reviewed
governance decision. A mistaken group claim can turn an
authentication mapping problem into instance-wide administrative
access.
10. Recovery path is part of the authentication design
Before enabling or changing external authentication, write down:
- Which local administrator account remains available.
- How that account is stored and tested securely.
- How to reach the internal/local SonarQube endpoint if the external proxy is broken.
- How to revert the Server base URL and authentication properties.
- Which config files, environment variables, certificates, proxy files, and IdP objects were changed.
A recovery account is not a convenience; it is a control against lockout during IdP, DNS, certificate, proxy, or group-mapping failure.
11. Read-only inspection before configuration changes
# Local baseline
curl -fsS http://localhost:9000/api/system/status
# Record certificate identity on an existing HTTPS endpoint without disabling verification.
openssl s_client -connect sonarqube.example.test:443 \
-servername sonarqube.example.test -showcerts </dev/null
# Inspect DNS and route separately from application authentication.
nslookup sonarqube.example.test
curl -I https://sonarqube.example.test/
In the UI, capture Server base URL, enabled authentication mechanisms, group synchronization state, and a list of local administrator/recovery identities. Do not export secrets, private keys, SAML session contents, or tokens into the evidence packet.
Knowledge check
Does successful SAML authentication automatically grant SonarQube administrator permission?
No. Authentication establishes identity. SonarQube groups/global/project permissions authorize actions.
Where does HTTPS normally terminate for SonarQube inbound traffic?
At a reverse proxy/ingress/load balancer. SonarQube’s application listener receives HTTP on the trusted backend hop.
Why is
X-Forwarded-Proto security-sensitive?
SonarQube uses proxy-provided transport context for correct HTTPS/SAML behavior. Only a controlled proxy should be allowed to set/overwrite it.
Is generic OIDC currently documented as a native Community Build authentication method?
No. The current native authentication overview lists HTTP header, LDAP, SAML, GitHub, Bitbucket Cloud, and GitLab. Generic OIDC should be treated as an optional third-party/plugin or identity-broker decision.
Why keep a tested local administrator before enabling SSO?
It provides a recovery path for IdP, certificate, DNS, callback, proxy, or group-mapping failures.
Official references and version notes
- Community Build — authentication and provisioning overview — current native delegated-authentication list and JIT/group-synchronization model.
- Community Build — LDAP — LDAP/AD authentication, group synchronization, LDAPS/trust guidance, logs and migration notes.
- Community Build — SAML overview — SP-initiated SAML, IdP certificate, attributes and group synchronization.
- Community Build — Server base URL — canonical external URL required for authentication/integration correctness.
- Community Build — securing behind a proxy — inbound HTTP model, TLS termination, required forwarded headers, and proxy examples.
- Community Build — networking requirements — external systems, base-URL reachability, HTTPS/proxy topology, and network rules.
-
Community Build — SAML with Microsoft Entra ID
— Reply URL format
/oauth2/callback/samland base-URL dependency. - Community OIDC plugin (third party) — optional generic OIDC path; explicitly not a first-party SonarSource native authentication guarantee.
Rechecked 2026-09-08. Mandatory examples target
Community Build 26.9.0.129388. Current Community
Build documentation lists HTTP-header, LDAP, SAML, GitHub,
Bitbucket Cloud, and GitLab authentication; LDAP and SAML are
available in Community Build with JIT/group synchronization.
Generic OIDC is not listed as a native method in the current
Community Build authentication overview, so this chapter treats it
as a configuration simulation or optional third-party-plugin path
requiring independent compatibility/security review. SonarQube
accepts inbound application traffic as HTTP; production HTTPS is
terminated at a reverse proxy/ingress/load balancer. For
HTTPS/SAML, X-Forwarded-Proto and
X-Forwarded-For must be set by the trusted proxy.
Server base URL must match the externally reachable
origin/callback design. Automatic provisioning/SCIM and other
enterprise identity lifecycle features are
edition/provider-specific and are not required by the mandatory
local path. Recheck authentication support, plugin compatibility,
proxy headers, callback URLs, Java trust-store requirements, and
provisioning ownership before applying this material to another
release.
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this
address.