Skip to content

Commit fb591e2

Browse files
committed
Implement attribute mapping for Google
1 parent 3e96cff commit fb591e2

3 files changed

Lines changed: 115 additions & 7 deletions

File tree

packages/localizations/src/en-US.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,9 @@ export const enUS: LocalizationResource = {
596596
appAttribute: 'App attribute',
597597
},
598598
rows: {
599-
email: { name: 'mail' },
600-
firstName: { name: 'firstName' },
601-
lastName: { name: 'lastName' },
599+
email: { googleAttribute: 'Primary email', appAttribute: 'email' },
600+
firstName: { googleAttribute: 'First name', appAttribute: 'firstName' },
601+
lastName: { googleAttribute: 'Last name', appAttribute: 'lastName' },
602602
},
603603
},
604604
},

packages/shared/src/types/localization.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,12 +1645,11 @@ export type __internal_LocalizationResource = {
16451645
columns: {
16461646
googleAttribute: LocalizationValue;
16471647
appAttribute: LocalizationValue;
1648-
expression: LocalizationValue;
16491648
};
16501649
rows: {
1651-
email: { name: LocalizationValue };
1652-
firstName: { name: LocalizationValue };
1653-
lastName: { name: LocalizationValue };
1650+
email: { googleAttribute: LocalizationValue; appAttribute: LocalizationValue };
1651+
firstName: { googleAttribute: LocalizationValue; appAttribute: LocalizationValue };
1652+
lastName: { googleAttribute: LocalizationValue; appAttribute: LocalizationValue };
16541653
};
16551654
};
16561655
};

packages/ui/src/components/ConfigureSSO/steps/ConfigureStep/saml/SamlGoogleConfigureSteps.tsx

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useConfigureSSO } from '../../../ConfigureSSOContext';
1212
import { Step } from '../../../elements/Step';
1313
import { useWizard, Wizard } from '../../../elements/Wizard';
1414
import { InnerStepCounter } from '../../../elements/Wizard/InnerStepCounter';
15+
import { AttributeMappingTable, type AttributeMappingTableConfig } from './shared/AttributeMappingTable';
1516
import {
1617
applySamlSubmitError,
1718
buildSamlConfigurationPayload,
@@ -57,6 +58,16 @@ export const SamlGoogleConfigureSteps = (): JSX.Element => {
5758
</Step.Header>
5859
<SamlGoogleServiceProviderStep />
5960
</Wizard.Step>
61+
62+
<Wizard.Step id='attribute-mapping'>
63+
<Step.Header
64+
title={localizationKeys('configureSSO.configureStep.samlGoogle.mainHeaderTitle')}
65+
description={localizationKeys('configureSSO.configureStep.samlGoogle.attributeMappingStep.headerSubtitle')}
66+
>
67+
<InnerStepCounter />
68+
</Step.Header>
69+
<SamlGoogleAttributeMappingStep />
70+
</Wizard.Step>
6071
</>
6172
);
6273
};
@@ -452,3 +463,101 @@ const SamlGoogleServiceProviderStep = (): JSX.Element => {
452463
</>
453464
);
454465
};
466+
467+
const GOOGLE_ATTRIBUTE_MAPPING: AttributeMappingTableConfig = {
468+
columns: {
469+
first: localizationKeys(
470+
'configureSSO.configureStep.samlGoogle.attributeMappingStep.attributeMappingTable.columns.googleAttribute',
471+
),
472+
second: localizationKeys(
473+
'configureSSO.configureStep.samlGoogle.attributeMappingStep.attributeMappingTable.columns.appAttribute',
474+
),
475+
},
476+
rows: [
477+
{
478+
id: 'email',
479+
isRequired: true,
480+
first: localizationKeys(
481+
'configureSSO.configureStep.samlGoogle.attributeMappingStep.attributeMappingTable.rows.email.googleAttribute',
482+
),
483+
second: localizationKeys(
484+
'configureSSO.configureStep.samlGoogle.attributeMappingStep.attributeMappingTable.rows.email.appAttribute',
485+
),
486+
},
487+
{
488+
id: 'firstName',
489+
isRequired: false,
490+
first: localizationKeys(
491+
'configureSSO.configureStep.samlGoogle.attributeMappingStep.attributeMappingTable.rows.firstName.googleAttribute',
492+
),
493+
second: localizationKeys(
494+
'configureSSO.configureStep.samlGoogle.attributeMappingStep.attributeMappingTable.rows.firstName.appAttribute',
495+
),
496+
},
497+
{
498+
id: 'lastName',
499+
isRequired: false,
500+
first: localizationKeys(
501+
'configureSSO.configureStep.samlGoogle.attributeMappingStep.attributeMappingTable.rows.lastName.googleAttribute',
502+
),
503+
second: localizationKeys(
504+
'configureSSO.configureStep.samlGoogle.attributeMappingStep.attributeMappingTable.rows.lastName.appAttribute',
505+
),
506+
},
507+
],
508+
};
509+
510+
const SamlGoogleAttributeMappingStep = (): JSX.Element => {
511+
const { goNext, goPrev, isFirstStep, isLastStep } = useWizard();
512+
513+
return (
514+
<>
515+
<Step.Body>
516+
<Step.Section sx={theme => ({ gap: theme.space.$3 })}>
517+
<Text
518+
as='p'
519+
colorScheme='secondary'
520+
localizationKey={localizationKeys('configureSSO.configureStep.samlGoogle.attributeMappingStep.paragraph')}
521+
/>
522+
523+
<Col
524+
elementDescriptor={descriptors.configureSSOInstructionsList}
525+
as='ol'
526+
sx={theme => ({
527+
gap: theme.space.$1x5,
528+
margin: 0,
529+
paddingInlineStart: theme.space.$5,
530+
listStyleType: 'decimal',
531+
})}
532+
>
533+
<Text
534+
elementDescriptor={descriptors.configureSSOInstructionsListItem}
535+
as='li'
536+
colorScheme='secondary'
537+
localizationKey={localizationKeys('configureSSO.configureStep.samlGoogle.attributeMappingStep.step1')}
538+
/>
539+
<Text
540+
elementDescriptor={descriptors.configureSSOInstructionsListItem}
541+
as='li'
542+
colorScheme='secondary'
543+
localizationKey={localizationKeys('configureSSO.configureStep.samlGoogle.attributeMappingStep.step2')}
544+
/>
545+
</Col>
546+
547+
<AttributeMappingTable config={GOOGLE_ATTRIBUTE_MAPPING} />
548+
</Step.Section>
549+
</Step.Body>
550+
551+
<Step.Footer>
552+
<Step.Footer.Previous
553+
onClick={() => goPrev()}
554+
isDisabled={isFirstStep}
555+
/>
556+
<Step.Footer.Continue
557+
onClick={() => goNext()}
558+
isDisabled={isLastStep}
559+
/>
560+
</Step.Footer>
561+
</>
562+
);
563+
};

0 commit comments

Comments
 (0)