From 2d65b0c191d723fdd35523c3fe8ffb362d11ddb9 Mon Sep 17 00:00:00 2001 From: guillaume-peoch-sonarsource Date: Tue, 22 Aug 2023 17:15:51 +0200 Subject: [PATCH] SONAR-20232 Move SAML group attribute to common configuration for SAML --- .../org/sonar/auth/saml/SamlSettings.java | 2 +- .../authentication/SamlAuthenticationTab.tsx | 21 +------------------ .../__tests__/Authentication-it.tsx | 7 +------ 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlSettings.java b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlSettings.java index 3da572ea2af..2a06c235f85 100644 --- a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlSettings.java +++ b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlSettings.java @@ -189,7 +189,7 @@ public class SamlSettings { PropertyDefinition.builder(GROUP_NAME_ATTRIBUTE) .name("SAML group attribute") .description("Attribute defining the user groups in SAML, used to synchronize group memberships. If you leave this field empty, " + - "group memberships are managed locally by SonarQube administrators.") + "group memberships will not be synced when users log in.") .category(CATEGORY) .subCategory(SUBCATEGORY) .index(10) diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthenticationTab.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthenticationTab.tsx index edb9349490d..0deaa73e7aa 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthenticationTab.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthenticationTab.tsx @@ -36,12 +36,9 @@ import { } from '../../../../queries/identity-provider'; import { useSaveValueMutation } from '../../../../queries/settings'; import { ExtendedSettingDefinition } from '../../../../types/settings'; -import { getPropertyName } from '../../utils'; -import DefinitionDescription from '../DefinitionDescription'; import ConfigurationForm from './ConfigurationForm'; import useSamlConfiguration, { SAML_ENABLED_FIELD, - SAML_GROUP_NAME, SAML_SCIM_DEPRECATED, } from './hook/useSamlConfiguration'; @@ -52,7 +49,7 @@ interface SamlAuthenticationProps { export const SAML = 'saml'; const CONFIG_TEST_PATH = '/saml/validation_init'; -const SAML_EXCLUDED_FIELD = [SAML_ENABLED_FIELD, SAML_GROUP_NAME, SAML_SCIM_DEPRECATED]; +const SAML_EXCLUDED_FIELD = [SAML_ENABLED_FIELD, SAML_SCIM_DEPRECATED]; export default function SamlAuthenticationTab(props: SamlAuthenticationProps) { const { definitions } = props; @@ -253,22 +250,6 @@ export default function SamlAuthenticationTab(props: SamlAuthenticationProps) {

{translate('settings.authentication.saml.form.provisioning_at_login.sub')}

- {groupValue && ( -
- -
- setNewGroupSetting(e.currentTarget.value)} - type="text" - value={String(groupValue.newValue ?? groupValue.value ?? '')} - aria-label={getPropertyName(groupValue.definition)} - /> -
-
- )} ) : ( diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx index b61e05b3f86..2a09f47090b 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx @@ -92,7 +92,6 @@ const ui = { saveConfigButton: byRole('button', { name: 'settings.almintegration.form.save' }), confirmProvisioningButton: byRole('button', { name: 'yes' }), saveScim: byRole('button', { name: 'save' }), - groupAttribute: byRole('textbox', { name: 'property.sonar.auth.saml.group.name.name' }), enableConfigButton: byRole('button', { name: 'settings.authentication.form.enable' }), disableConfigButton: byRole('button', { name: 'settings.authentication.form.disable' }), editConfigButton: byRole('button', { name: 'settings.authentication.form.edit' }), @@ -309,11 +308,7 @@ describe('SAML tab', () => { await user.click(await saml.enableConfigButton.find()); expect(await saml.jitProvisioningButton.find()).toBeChecked(); - - await user.type(saml.groupAttribute.get(), 'group'); - expect(saml.saveScim.get()).toBeEnabled(); - await user.click(saml.saveScim.get()); - await waitFor(() => expect(saml.saveScim.query()).toBeDisabled()); + expect(saml.saveScim.get()).toBeDisabled(); await user.click(saml.scimProvisioningButton.get()); expect(saml.saveScim.get()).toBeEnabled(); -- 2.39.5