vaulttec / sonar-auth-oidc

OpenID Connect (OIDC) Plugin for SonarQube
Apache License 2.0
101 stars 35 forks source link
authentication authorization openid-connect plugin sonarqube

OpenID Connect (OIDC) Plugin for SonarQube

Build Status Quality Gate Release Marketplace

Description

This plugin enables users to automatically be sign up and authenticated on a SonarQube server via an OpenID Connect identity provider like Keycloak. SonarQube Login

Optionally the groups a user is associated in SonarQube can be synchronized with the provider (via a custom userinfo claim retrieved from the ID token).

For communicating with the OpenID Connect provider this plugin uses the Nimbus OAuth 2.0 SDK with OpenID Connect extensions.

Prerequisites

Server Base URL

SonarQube's Server base URL property must be set either by setting the URL from SonarQube administration page (General > Server base URL) or the property sonar.core.serverBaseURL in the sonar.properties.

In this URL no trailing slash is allowed! Otherwise the redirects from the identity provider back to the SonarQube server are not created correctly.

Force user authentication

If the plugin's Auto-Login feature is enabled then SonarQube's Force user authentication property must be enabled either from SonarQube administration page (Security > Force user authentication) or the property sonar.forceAuthentication in the sonar.properties.

Otherwise the plugin won't be able to automatically redirect to the IdP's login page.

Network Proxy

If a network proxy is used with SonarQube (via http[s].proxy[Host|Port] properties in the sonar.properties) and the host name of the identity provider is not resolvable by this proxy then the IdP's host name must be excluded from being resolved by the proxy. This is done by defining the property http.nonProxyHosts in the sonar.properties.

Otherwise the plugin won't be able to send the token request to the IdP.

Installation

  1. Install the plugin from SonarQube marketplace via "Administration > Marketplace". Or download the plugin jar from GitHub Releases and put it into the SONARQUBE_HOME/extensions/plugins/ directory
  2. Restart the SonarQube server

Configuration

Troubleshooting

To troubleshoot issues with this plugin activate SonarQube's debug logging (Administration > System > Logs level) and download the Web Server log: SonarQube System Logs

In the Web Server log file the plugin's log entries can be identified by the package name of it's Java classes org.vaulttec.sonarqube.auth.oidc which is abbreviated as o.v.s.a.o: SonarQube Web Server Log Sample

Tested with