diff --git a/public/app/features/auth-config/ProviderConfigForm.test.tsx b/public/app/features/auth-config/ProviderConfigForm.test.tsx index e21fe275b6e..469766c29f3 100644 --- a/public/app/features/auth-config/ProviderConfigForm.test.tsx +++ b/public/app/features/auth-config/ProviderConfigForm.test.tsx @@ -52,12 +52,12 @@ const testConfig: SSOProvider = { clientId: '12345', clientSecret: 'abcde', enabled: true, - teamIds: '', - allowedOrganizations: '', - allowedDomains: '', - allowedGroups: '', - scopes: '', - orgMapping: '', + teamIds: '[]', + allowedOrganizations: '[]', + allowedDomains: '[]', + allowedGroups: '[]', + scopes: '[]', + orgMapping: '[]', }, }; @@ -147,8 +147,8 @@ describe('ProviderConfigForm', () => { settings: { allowAssignGrafanaAdmin: false, allowSignUp: false, - allowedDomains: 'grafana.com', - allowedOrganizations: '', + allowedDomains: '["grafana.com"]', + allowedOrganizations: '[]', autoLogin: true, clientId: 'test-client-id', clientSecret: 'test-client-secret', @@ -157,10 +157,10 @@ describe('ProviderConfigForm', () => { orgMapping: '["Group A:1:Editor","Group B:2:Admin"]', roleAttributePath: 'new-attribute-path', roleAttributeStrict: true, - scopes: 'user:email', + scopes: '["user:email"]', signoutRedirectUrl: '', skipOrgRoleSync: false, - teamIds: '', + teamIds: '[]', tlsClientCa: '', tlsClientCert: '', tlsClientKey: '', @@ -197,8 +197,8 @@ describe('ProviderConfigForm', () => { settings: { allowAssignGrafanaAdmin: false, allowSignUp: false, - allowedDomains: '', - allowedOrganizations: '', + allowedDomains: '[]', + allowedOrganizations: '[]', autoLogin: true, clientId: 'test-client-id', clientSecret: 'test-client-secret', @@ -206,16 +206,16 @@ describe('ProviderConfigForm', () => { name: 'GitHub', roleAttributePath: '', roleAttributeStrict: false, - scopes: 'user:email', + scopes: '["user:email"]', signoutRedirectUrl: '', skipOrgRoleSync: false, - teamIds: '', + teamIds: '[]', tlsClientCa: '', tlsClientCert: '', tlsClientKey: '', usePkce: false, useRefreshToken: false, - orgMapping: '', + orgMapping: '[]', }, }, { showErrorAlert: false } diff --git a/public/app/features/auth-config/utils/data.ts b/public/app/features/auth-config/utils/data.ts index 47ed8112ab0..c0beae9ec27 100644 --- a/public/app/features/auth-config/utils/data.ts +++ b/public/app/features/auth-config/utils/data.ts @@ -78,10 +78,7 @@ export function dataToDTO(data?: SSOProvider): SSOProviderDTO { } const valuesToString = (values: Array>) => { - if (values.length <= 1) { - return values.map(({ value }) => value).join(','); - } - // Store as JSON array if there are multiple values + // Store arrays as JSON array return JSON.stringify(values.map(({ value }) => value)); };