Setting up authentication
Setting up the GitLab authentication and provisioning in SonarQube Server.
You can delegate in SonarQube Server the authentication to GitLab by using one of the following provisioning modes:
- Just-in-Time 
- Automatic 
You need the global Administer System permission in SonarQube Server to set up the authentication delegation.
Setup overview
SonarQube Server uses a GitLab OAuth 2 application to manage the authentication delegation to GitLab and the user or group synchronization. SonarQube Server uses a "GitLab Configuration" record to access the GitLab application.

Step 1: Create a GitLab application for authentication and provisioning
- Create a GitLab OAuth 2 application: see the GitLab documentation. 
- Specify the following settings in your GitLab application: - Name: Your app’s name, such as SonarQube Server. 
- Redirect URI: - <Your SonarQube Server URL>/oauth2/callback/gitlab. For example, https://sonarqube.mycompany.com/oauth2/callback/gitlab.
- Scopes: Select - apiif you plan to enable group synchronization with Just-in-Time or enable automatic provisioning. Select- read_userotherwise.
 
- Save your application. GitLab takes you to the application’s page, where you can find your Application ID and Secret you’ll need in Step 2 below. 
Step 2: Configure GitLab authentication and provisioning in SonarQube Server
- In in SonarQube Server, go to Administration > Configuration > General Settings > Authentication > GitLab. 
- In GitLab configuration, select Create configuration. The New GitLab Configuration dialog opens. 

- Fill the fields of GitLab configuration with information from the GitLab application created in Step 1: - Application ID 
- GitLab URL: Enter - https://gitlab.comor your own GitLab server URL where applicable.
- Secret 
 
- Select the Synchronize user groups option if you want to enable group synchronization at user login: - In Just-in-Time provisioning mode, this means that group synchronization is enabled. 
- In automatic provisioning mode, this means that users’ group memberships are also synchronized at user authentication time (and not only on an hourly basis). 
 
- Select Save configuration. The configuration is created. 

- Select Test configuration to check the configuration. Correct it if necessary. 
- You can now enable the automatic provisioning option by selecting Automatic user, group, and permission provisioning. See Managing automatic provisioning for more information. If you don’t want to use the automatic provisioning option, you can configure JIT provisioning options in the Provisioning > Just-in-Time provisioning section, see Managing JIT provisioning. 
Related pages
Last updated
Was this helpful?

