]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20923 Unclear message in case GitHub OAuth App is used for Authentication
authorguillaume-peoch-sonarsource <guillaume.peoch@sonarsource.com>
Wed, 1 Nov 2023 16:37:14 +0000 (17:37 +0100)
committersonartech <sonartech@sonarsource.com>
Thu, 2 Nov 2023 20:02:42 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/settings/components/authentication/GithubAuthenticationTab.tsx
server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx
server/sonar-web/src/main/js/helpers/mocks/definitions-list.ts
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 7843eec2a5f8f4a0857cdacbbb167cf24685a2e4..665e5c027e608885640726691d7e943051e7aecc 100644 (file)
@@ -124,7 +124,7 @@ export default function GithubAuthenticationTab(props: GithubAuthenticationProps
           </div>
         )}
       </div>
-      {enabled && (
+      {enabled && !hasLegacyConfiguration && (
         <GitHubConfigurationValidity
           selectedOrganizations={
             (values['sonar.auth.github.organizations']?.value as string[]) ?? []
@@ -146,7 +146,7 @@ export default function GithubAuthenticationTab(props: GithubAuthenticationProps
               values={{
                 documentation: (
                   <DocLink to="/instance-administration/authentication/github">
-                    {translate('documentation')}
+                    {translate('settings.authentication.github.form.legacy_configured.link')}
                   </DocLink>
                 ),
               }}
index 450e66cddc25d235d8d099454496737cd64c0a65..18c872bacddff8734c695b5db8ea8e23176e0c80 100644 (file)
@@ -134,6 +134,8 @@ const ui = {
     noGithubConfiguration: byText('settings.authentication.github.form.not_configured'),
     createConfigButton: byRole('button', { name: 'settings.authentication.form.create' }),
     clientId: byRole('textbox', { name: 'property.sonar.auth.github.clientId.secured.name' }),
+    appId: byRole('textbox', { name: 'property.sonar.auth.github.appId.name' }),
+    privateKey: byRole('textbox', { name: 'property.sonar.auth.github.privateKey.secured.name' }),
     clientSecret: byRole('textbox', {
       name: 'property.sonar.auth.github.clientSecret.secured.name',
     }),
@@ -235,6 +237,8 @@ const ui = {
       await act(async () => {
         await user.type(await github.clientId.find(), 'Awsome GITHUB config');
         await user.type(github.clientSecret.get(), 'Client shut');
+        await user.type(github.appId.get(), 'App id');
+        await user.type(github.privateKey.get(), 'Private Key');
         await user.type(github.githubApiUrl.get(), 'API Url');
         await user.type(github.githubWebUrl.get(), 'WEb Url');
         await user.type(github.organizations.get(), 'organization1');
@@ -356,7 +360,7 @@ describe('SAML tab', () => {
     await user.click(saml.scimProvisioningButton.get());
     expect(saml.saveScim.get()).toBeEnabled();
     await user.click(saml.saveScim.get());
-    await user.click(saml.confirmProvisioningButton.get());
+    await act(() => user.click(saml.confirmProvisioningButton.get()));
 
     expect(await saml.scimProvisioningButton.find()).toBeChecked();
     expect(await saml.saveScim.find()).toBeDisabled();
@@ -480,7 +484,7 @@ describe('Github tab', () => {
 
     expect(github.saveGithubProvisioning.get()).toBeEnabled();
     await user.click(github.saveGithubProvisioning.get());
-    await user.click(github.confirmProvisioningButton.get());
+    await act(() => user.click(github.confirmProvisioningButton.get()));
 
     expect(await github.githubProvisioningButton.find()).toBeChecked();
     expect(github.disableConfigButton.get()).toBeDisabled();
index bb61f1e9f369425d87ca15dcd5aaa283fe206aa3..b981aeb97ac2afa575a9b3e5ab4de70e76804777 100644 (file)
@@ -147,6 +147,27 @@ export const definitions: ExtendedSettingDefinition[] = [
     options: [],
     fields: [],
   },
+  {
+    key: 'sonar.auth.github.appId',
+    name: 'App ID',
+    description:
+      'The App ID is found on your GitHub App\u0027s page on GitHub at Settings \u003e Developer Settings \u003e GitHub Apps.',
+    category: 'authentication',
+    subCategory: 'github',
+    options: [],
+    fields: [],
+  },
+  {
+    key: 'sonar.auth.github.privateKey.secured',
+    name: 'Private Key',
+    description:
+      'Your GitHub App\u0027s private key. You can generate a .pem file from your GitHub App\u0027s page under Private keys.\nCopy and paste the whole contents of the file here.',
+    type: SettingType.TEXT,
+    category: 'authentication',
+    subCategory: 'github',
+    options: [],
+    fields: [],
+  },
   {
     key: 'sonar.auth.github.clientSecret.secured',
     name: 'Client Secret',
index 5199d1d23a6bd4f864def0b529d3a95383d70109..580d9e76bcde3dd122dd34c49ec527d49cf9d485 100644 (file)
@@ -1511,7 +1511,8 @@ settings.authentication.github.confirm_auto_provisioning.switch_jit=Just-in-Time
 settings.authentication.github.provisioning_change.confirm_changes=Confirm Changes
 settings.authentication.github.configuration=GitHub Configuration
 settings.authentication.github.form.not_configured=GitHub App is not configured
-settings.authentication.github.form.legacy_configured=Compatibility with GitHub OAuth App is deprecated and will be removed in a future release. Your configuration will continue to work but with limited support. We recommend using GitHub Apps. Check out the {documentation} for more information.
+settings.authentication.github.form.legacy_configured=Compatibility with GitHub OAuth Apps is deprecated and will be removed in a future release. As such, your current configuration will continue to work but some features will no longer be available. We recommend that you create a new GitHub App configuration. This will automatically replace your current GitHub OAuth App configuration. {documentation}
+settings.authentication.github.form.legacy_configured.link=Learn more about how to create a GitHub App configuration
 settings.authentication.github.enable_first=Enable your GitHub configuration for more provisioning options.
 settings.authentication.github.form.provisioning_with_github=Automatic user, group, and permission provisioning
 settings.authentication.github.form.provisioning_with_github_short.autoProvisioning=Automatic provisioning