import java.util.List;
import java.util.function.Supplier;
import javax.annotation.CheckForNull;
-import org.sonar.api.CoreProperties;
import org.sonar.api.PropertyType;
import org.sonar.api.config.Configuration;
import org.sonar.api.config.PropertyDefinition;
public static final String WORKSPACE_ALLOWED_LIST = "sonar.auth.bitbucket.workspaces";
public static final String DEFAULT_API_URL = "https://api.bitbucket.org/";
public static final String DEFAULT_WEB_URL = "https://bitbucket.org/";
+ public static final String CATEGORY = "authentication";
public static final String SUBCATEGORY = "bitbucket";
private final Configuration config;
PropertyDefinition.builder(ENABLED)
.name("Enabled")
.description("Enable Bitbucket users to login. Value is ignored if consumer key and secret are not defined.")
- .category(CoreProperties.CATEGORY_ALM_INTEGRATION)
+ .category(CATEGORY)
.subCategory(SUBCATEGORY)
.type(PropertyType.BOOLEAN)
.defaultValue(String.valueOf(false))
PropertyDefinition.builder(CONSUMER_KEY)
.name("OAuth consumer key")
.description("Consumer key provided by Bitbucket when registering the consumer.")
- .category(CoreProperties.CATEGORY_ALM_INTEGRATION)
+ .category(CATEGORY)
.subCategory(SUBCATEGORY)
.index(2)
.build(),
PropertyDefinition.builder(CONSUMER_SECRET)
.name("OAuth consumer secret")
.description("Consumer secret provided by Bitbucket when registering the consumer.")
- .category(CoreProperties.CATEGORY_ALM_INTEGRATION)
+ .category(CATEGORY)
.subCategory(SUBCATEGORY)
.index(3)
.build(),
PropertyDefinition.builder(ALLOW_USERS_TO_SIGN_UP)
.name("Allow users to sign-up")
.description("Allow new users to authenticate. When set to 'false', only existing users will be able to authenticate.")
- .category(CoreProperties.CATEGORY_ALM_INTEGRATION)
+ .category(CATEGORY)
.subCategory(SUBCATEGORY)
.type(PropertyType.BOOLEAN)
.defaultValue(String.valueOf(true))
PropertyDefinition.builder(WORKSPACE_ALLOWED_LIST)
.name("Workspaces")
.description("Only members of at least one of these workspace will be able to authenticate. Keep empty to disable workspace restriction. You can use either the workspace name, or the workspace slug (ex: https://bitbucket.org/{workspace-slug}).")
- .category(CoreProperties.CATEGORY_ALM_INTEGRATION)
+ .category(CATEGORY)
.subCategory(SUBCATEGORY)
.multiValues(true)
.index(5)
import java.util.List;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import org.sonar.api.CoreProperties;
import org.sonar.api.config.Configuration;
import org.sonar.api.config.PropertyDefinition;
public static final String WEB_URL = "sonar.auth.github.webUrl";
public static final String ORGANIZATIONS = "sonar.auth.github.organizations";
- private static final String CATEGORY = CoreProperties.CATEGORY_ALM_INTEGRATION;
+ private static final String CATEGORY = "authentication";
private static final String SUBCATEGORY = "github";
private final Configuration configuration;
import java.util.Arrays;
import java.util.List;
-import org.sonar.api.CoreProperties;
import org.sonar.api.PropertyType;
import org.sonar.api.config.Configuration;
import org.sonar.api.config.PropertyDefinition;
public static final String GITLAB_AUTH_ALLOW_USERS_TO_SIGNUP = "sonar.auth.gitlab.allowUsersToSignUp";
public static final String GITLAB_AUTH_SYNC_USER_GROUPS = "sonar.auth.gitlab.groupsSync";
- private static final String CATEGORY = CoreProperties.CATEGORY_ALM_INTEGRATION;
+ private static final String CATEGORY = "authentication";
private static final String SUBCATEGORY = "gitlab";
private final Configuration configuration;
public static final String SERVICE_PROVIDER_CERTIFICATE = "sonar.auth.saml.sp.certificate.secured";
public static final String SERVICE_PROVIDER_PRIVATE_KEY = "sonar.auth.saml.sp.privateKey.secured";
- public static final String CATEGORY = "security";
+ public static final String CATEGORY = "authentication";
public static final String SUBCATEGORY = "saml";
private final Configuration configuration;
- **Permissions** – Grant **Read** access for the **Pull requests** permission.
### Setting your global DevOps Platform Integration settings
-To set your global DevOps Platform Integration settings, navigate to **Administration > DevOps Platform Integrations**, select the **Bitbucket** tab, and select **Bitbucket Cloud** as the variant you want to configure. From here, specify the following settings:
+To set your global DevOps Platform Integration settings, navigate to **Administration > Configuration > General Settings > DevOps Platform Integrations**, select the **Bitbucket** tab, and select **Bitbucket Cloud** as the variant you want to configure. From here, specify the following settings:
- **Configuration Name** (Enterprise and Data Center Edition only) – The name used to identify your Bitbucket Cloud configuration at the project level. Use something succinct and easily recognizable.
- **Workspace ID** – The workspace ID is part of your bitbucket cloud URL `https://bitbucket.org/{WORKSPACE-ID}/{repository-slug}`
| If you're using the same OAuth consumer for authentication and importing projects/reporting status to pull requests, make sure that the **This is a private consumer** box is checked and **Read** access for the **Pull requests** permission is granted.
### Setting your authentication settings in SonarQube
-To set your global authentication settings, navigate to **Administration > DevOps Platform Integrations** and select the **Bitbucket** tab. Scroll down to the **Bitbucket Authentication** section and update the following settings:
+To set your global authentication settings, navigate to **Administration > Configuration > General Settings > Authentication > Bitbucket Cloud Authentication** and update the following settings:
- **Enabled** - set to true.
- **OAuth consumer key** - enter the **Key** from your OAuth consumer page in Bitbucket.
1. Add a personal access token for importing repositories
### Setting your global DevOps Platform Integration settings
-To set your global DevOps Platform Integration settings, navigate to **Administration > DevOps Platform Integrations**, select the **Bitbucket** tab, and select **Bitbucket Server** as the variant you want to configure. From here, specify the following settings:
+To set your global DevOps Platform Integration settings, navigate to **Administration > Configuration > General Settings > DevOps Platform Integrations**, select the **Bitbucket** tab, and select **Bitbucket Server** as the variant you want to configure. From here, specify the following settings:
- **Configuration Name** (Enterprise and Data Center Edition only) – The name used to identify your Bitbucket Server configuration at the project level. Use something succinct and easily recognizable.
- **Bitbucket Server URL** – your instances URL. For example, `https://bitbucket-server.your-company.com`.
To update your global SonarQube settings:
-Navigate to **Administration > Configuration > General Settings > DevOps Platform Integrations > GitHub > GitHub Authentication** and update the following:
+Navigate to **Administration > Configuration > General Settings > Authentication > GitHub Authentication** and update the following:
1. **Enabled** – set the switch to `true`.
1. **Client ID** – the Client ID is found below the GitHub App ID on your GitHub App's page.
After creating your app, update your global SonarQube settings:
-Navigate to **Administration > Configuration > General Settings > DevOps Platform Integrations > GitHub > GitHub Authentication** and update the following:
+Navigate to **Administration > Configuration > General Settings > Authentication > GitHub Authentication** and update the following:
1. **Enabled** – set the switch to `true`.
1. **Client ID** – the Client ID is found below the GitHub App ID on your GitHub App's page.
- **Redirect URI** – enter your SonarQube URL with the path `/oauth2/callback/gitlab`. For example, `https://sonarqube.mycompany.com/oauth2/callback/gitlab`.
- **Scopes** – select **api** if you plan to enable group synchronization. Select **read_user** if you only plan to delegate authentication.
-After saving your application, GitLab takes you to the app's page. Here you find your **Application ID** and **Secret**. Keep these handy, open your SonarQube instance, and navigate to **Administration > Configuration > General Settings > DevOps Platform Integrations > GitLab > Authentication**. Set the following settings to finish setting up GitLab authentication:
+After saving your application, GitLab takes you to the app's page. Here you find your **Application ID** and **Secret**. Keep these handy, open your SonarQube instance, and navigate to **Administration > Configuration > General Settings > Authentication > GitLab Authentication**. Set the following settings to finish setting up GitLab authentication:
- **Enabled** – set to `true`.
- **Application ID** – the Application ID is found on your GitLab app's page.
renderComponent: getAlmIntegrationComponent,
availableGlobally: true,
availableForProject: false,
- displayTab: false
+ displayTab: true
},
{
key: PULL_REQUEST_DECORATION_BINDING_CATEGORY,
AlmSettingsBindingStatusType
} from '../../../../types/alm-settings';
import { AppState } from '../../../../types/appstate';
-import { ExtendedSettingDefinition } from '../../../../types/settings';
import { Dict } from '../../../../types/types';
import AlmIntegrationRenderer from './AlmIntegrationRenderer';
interface Props {
appState: AppState;
- definitions: ExtendedSettingDefinition[];
location: Location;
router: Router;
}
render() {
const {
- appState: { branchesEnabled, multipleAlmEnabled },
- definitions: settingsDefinitions
+ appState: { branchesEnabled, multipleAlmEnabled }
} = this.props;
const {
currentAlmTab,
loadingAlmDefinitions={loadingAlmDefinitions}
loadingProjectCount={loadingProjectCount}
projectCount={projectCount}
- settingsDefinitions={settingsDefinitions}
/>
);
}
AlmSettingsBindingDefinitions,
AlmSettingsBindingStatus
} from '../../../../types/alm-settings';
-import { ExtendedSettingDefinition } from '../../../../types/settings';
import { Dict } from '../../../../types/types';
import { AlmTabs } from './AlmIntegration';
import AlmTab from './AlmTab';
onSelectAlmTab: (alm: AlmTabs) => void;
onUpdateDefinitions: () => void;
projectCount?: number;
- settingsDefinitions: ExtendedSettingDefinition[];
}
const tabs = [
loadingProjectCount,
branchesEnabled,
multipleAlmEnabled,
- projectCount,
- settingsDefinitions
+ projectCount
} = props;
const bindingDefinitions = {
onCheck={props.onCheckConfiguration}
onDelete={props.onDelete}
onUpdateDefinitions={props.onUpdateDefinitions}
- settingsDefinitions={settingsDefinitions}
/>
{definitionKeyForDeletion && (
AlmBindingDefinitionBase,
AlmSettingsBindingStatus
} from '../../../../types/alm-settings';
-import { ExtendedSettingDefinition } from '../../../../types/settings';
import { Dict } from '../../../../types/types';
import { AlmTabs } from './AlmIntegration';
import AlmTabRenderer from './AlmTabRenderer';
onCheck: (definitionKey: string) => void;
onDelete: (definitionKey: string) => void;
onUpdateDefinitions: () => void;
- settingsDefinitions: ExtendedSettingDefinition[];
}
interface State {
definitionStatus,
loadingAlmDefinitions,
loadingProjectCount,
- multipleAlmEnabled,
- settingsDefinitions
+ multipleAlmEnabled
} = this.props;
const { editDefinition, editedDefinition } = this.state;
onEdit={this.handleEdit}
onCancel={this.handleCancel}
afterSubmit={this.handleAfterSubmit}
- settingsDefinitions={settingsDefinitions}
/>
);
}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
+import { Link } from 'react-router-dom';
import { Button } from '../../../../components/controls/buttons';
+import { Alert } from '../../../../components/ui/Alert';
import DeferredSpinner from '../../../../components/ui/DeferredSpinner';
import { translate } from '../../../../helpers/l10n';
import {
AlmSettingsBindingStatus,
isBitbucketCloudBindingDefinition
} from '../../../../types/alm-settings';
-import { ExtendedSettingDefinition } from '../../../../types/settings';
import { Dict } from '../../../../types/types';
-import { ALM_INTEGRATION_CATEGORY } from '../../constants';
-import CategoryDefinitionsList from '../CategoryDefinitionsList';
import AlmBindingDefinitionBox from './AlmBindingDefinitionBox';
import AlmBindingDefinitionForm from './AlmBindingDefinitionForm';
import { AlmTabs } from './AlmIntegration';
onDelete: (definitionKey: string) => void;
onEdit: (definitionKey: string) => void;
afterSubmit: (config: AlmBindingDefinitionBase) => void;
- settingsDefinitions: ExtendedSettingDefinition[];
}
+const AUTHENTICATION_AVAILABLE_PLATFORMS = [
+ AlmKeys.GitHub,
+ AlmKeys.GitLab,
+ AlmKeys.BitbucketServer
+];
+
export default function AlmTabRenderer(props: AlmTabRendererProps) {
const {
almTab,
editedDefinition,
loadingAlmDefinitions,
loadingProjectCount,
- multipleAlmEnabled,
- settingsDefinitions
+ multipleAlmEnabled
} = props;
const preventCreation = loadingProjectCount || (!multipleAlmEnabled && definitions.length > 0);
)}
</DeferredSpinner>
</div>
-
- <div className="huge-spacer-top huge-spacer-bottom bordered-top" />
-
- <div className="big-padded">
- <CategoryDefinitionsList
- category={ALM_INTEGRATION_CATEGORY}
- definitions={settingsDefinitions}
- subCategory={almTab}
- />
- </div>
+ {AUTHENTICATION_AVAILABLE_PLATFORMS.includes(almTab) && (
+ <Alert variant="info" className="spacer">
+ <FormattedMessage
+ id="settings.almintegration.tabs.authentication-moved"
+ defaultMessage={translate('settings.almintegration.tabs.authentication_moved')}
+ values={{
+ link: (
+ <Link
+ to={{
+ pathname: '/admin/settings?category=authentication'
+ }}>
+ {translate('property.category.authentication')}
+ </Link>
+ )
+ }}
+ />
+ </Alert>
+ )}
</div>
);
}
return shallow<AlmIntegration>(
<AlmIntegration
appState={mockAppState({ branchesEnabled: true })}
- definitions={[]}
location={mockLocation()}
router={mockRouter()}
{...props}
onDelete={jest.fn()}
onSelectAlmTab={jest.fn()}
onUpdateDefinitions={jest.fn()}
- settingsDefinitions={[]}
{...props}
/>
);
onCheck={jest.fn()}
onDelete={jest.fn()}
onUpdateDefinitions={jest.fn()}
- settingsDefinitions={[]}
{...props}
/>
);
onDelete={jest.fn()}
onEdit={jest.fn()}
afterSubmit={jest.fn()}
- settingsDefinitions={[]}
{...props}
/>
);
onDelete={[Function]}
onSelectAlmTab={[Function]}
onUpdateDefinitions={[Function]}
- settingsDefinitions={Array []}
/>
`;
onCheck={[MockFunction]}
onDelete={[MockFunction]}
onUpdateDefinitions={[MockFunction]}
- settingsDefinitions={Array []}
/>
</Fragment>
`;
onCheck={[MockFunction]}
onDelete={[MockFunction]}
onUpdateDefinitions={[MockFunction]}
- settingsDefinitions={Array []}
/>
</Fragment>
`;
onCheck={[MockFunction]}
onDelete={[MockFunction]}
onUpdateDefinitions={[MockFunction]}
- settingsDefinitions={Array []}
/>
</Fragment>
`;
onCheck={[MockFunction]}
onDelete={[MockFunction]}
onUpdateDefinitions={[MockFunction]}
- settingsDefinitions={Array []}
/>
<DeleteModal
id="keyToDelete"
onCheck={[MockFunction]}
onDelete={[MockFunction]}
onUpdateDefinitions={[MockFunction]}
- settingsDefinitions={Array []}
/>
</Fragment>
`;
onCheck={[MockFunction]}
onDelete={[MockFunction]}
onUpdateDefinitions={[MockFunction]}
- settingsDefinitions={Array []}
/>
</Fragment>
`;
onCreate={[Function]}
onDelete={[MockFunction]}
onEdit={[Function]}
- settingsDefinitions={Array []}
/>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
</div>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
</div>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
- >
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="azure"
- />
- </div>
</div>
`;
/>
</DeferredSpinner>
</div>
- <div
- className="huge-spacer-top huge-spacer-bottom bordered-top"
- />
- <div
- className="big-padded"
+ <Alert
+ className="spacer"
+ variant="info"
>
- <CategoryDefinitionsList
- category="almintegration"
- definitions={Array []}
- subCategory="bitbucket"
+ <FormattedMessage
+ defaultMessage="settings.almintegration.tabs.authentication_moved"
+ id="settings.almintegration.tabs.authentication-moved"
+ values={
+ Object {
+ "link": <Link
+ to={
+ Object {
+ "pathname": "/admin/settings?category=authentication",
+ }
+ }
+ >
+ property.category.authentication
+ </Link>,
+ }
+ }
/>
- </div>
+ </Alert>
</div>
`;
settings.almintegration.feature.alm_repo_import.disabled=Disabled
settings.almintegration.feature.alm_repo_import.disabled.multiple=This feature is disabled because you have 2 or more integration instances configured.
settings.almintegration.feature.alm_repo_import.disabled.no_url=This feature is disabled because your configured instance has no URL.
+settings.almintegration.tabs.authentication_moved=You can delegate authentication to this DevOps Platform. The relevant settings are under the {link} section.
settings.pr_decoration.binding.category=DevOps Platform Integration
settings.pr_decoration.binding.no_bindings=A system administrator needs to enable this feature in the global settings.
property.category.general.qualityGate=Quality Gate
property.category.general.subProjects=Sub-projects
property.category.almintegration=DevOps Platform Integrations
-property.category.almintegration.github=GitHub Authentication
-property.category.almintegration.github.description=In order to enable authentication on GitHub.com or GitHub Enterprise:<ul><li>SonarQube must be publicly accessible through HTTPS only</li><li>The property 'sonar.core.serverBaseURL' must be set to this public HTTPS URL</li><li>In your GitHub profile, you need to create a Developer Application for which the 'Authorization callback URL' must be set to <code>'<value_of_sonar.core.serverBaseURL_property>/oauth2/callback'</code>.</li></ul>
-property.category.almintegration.gitlab=GitLab Authentication
-property.category.almintegration.gitlab.description=In order to enable GitLab authentication, the property 'sonar.core.serverBaseURL' must be set to the public URL
-property.category.almintegration.bitbucket=Bitbucket Cloud Authentication
-property.category.almintegration.bitbucket.description=In order to enable authentication on Bitbucket.org: <ul><li>SonarQube must be publicly accessible through HTTPS only</li><li>The property 'sonar.core.serverBaseURL' must be set to this public HTTPS URL</li><li>In your Bitbucket OAuth Consumer settings, 'Callback URL' must be set to <code>'<value_of_sonar.core.serverBaseURL_property>'</code>.</li></ul>
+property.category.authentication=Authentication
+property.category.authentication.github=GitHub Authentication
+property.category.authentication.github.description=In order to enable authentication on GitHub.com or GitHub Enterprise:<ul><li>SonarQube must be publicly accessible through HTTPS only</li><li>The property 'sonar.core.serverBaseURL' must be set to this public HTTPS URL</li><li>In your GitHub profile, you need to create a Developer Application for which the 'Authorization callback URL' must be set to <code>'<value_of_sonar.core.serverBaseURL_property>/oauth2/callback'</code>.</li></ul>
+property.category.authentication.gitlab=GitLab Authentication
+property.category.authentication.gitlab.description=In order to enable GitLab authentication, the property 'sonar.core.serverBaseURL' must be set to the public URL
+property.category.authentication.bitbucket=Bitbucket Cloud Authentication
+property.category.authentication.bitbucket.description=In order to enable authentication on Bitbucket.org: <ul><li>SonarQube must be publicly accessible through HTTPS only</li><li>The property 'sonar.core.serverBaseURL' must be set to this public HTTPS URL</li><li>In your Bitbucket OAuth Consumer settings, 'Callback URL' must be set to <code>'<value_of_sonar.core.serverBaseURL_property>'</code>.</li></ul>
+property.category.authentication.saml=SAML
+property.category.authentication.saml.description=In order to enable SAML authentication, the property 'sonar.core.serverBaseURL' must be set to the public URL
property.category.organizations=Organizations
property.category.security=Security
property.category.security.encryption=Encryption
-property.category.security.saml=SAML
-property.category.security.saml.description=In order to enable SAML authentication, the property 'sonar.core.serverBaseURL' must be set to the public URL
property.category.java=Java
property.category.differentialViews=New Code
property.category.codeCoverage=Code Coverage