Skip to content

Commit 3e96cff

Browse files
committed
Implement service provider step for Google
1 parent 09af462 commit 3e96cff

4 files changed

Lines changed: 125 additions & 3 deletions

File tree

packages/localizations/src/en-US.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export const enUS: LocalizationResource = {
364364
paragraph1:
365365
'Once you have moved forward from the General Settings instructions, you will be presented with the Configure SAML page.',
366366
paragraph2:
367-
'To configure your service provider (Clerk), you must add these two fields to your Okta application:',
367+
'To configure your service provider, you must add these two fields to your Okta SAML application:',
368368
serviceProviderFields: {
369369
acsUrl: {
370370
label: 'Single sign-on URL',
@@ -566,9 +566,10 @@ export const enUS: LocalizationResource = {
566566
},
567567
},
568568
serviceProviderStep: {
569-
title: 'Add service provider configuration to Google Workspace',
569+
headerSubtitle: 'Configure service provider',
570+
title: 'Configure service provider',
570571
paragraph:
571-
'To configure your service provider (Clerk), you must add these two fields to your Google Workspace SAML application:',
572+
'To configure your service provider, you must add these two fields to your Google Workspace SAML application:',
572573
serviceProviderFields: {
573574
acsUrl: {
574575
label: 'ACS URL',

packages/shared/src/types/localization.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,7 @@ export type __internal_LocalizationResource = {
16201620
};
16211621
};
16221622
serviceProviderStep: {
1623+
headerSubtitle: LocalizationValue;
16231624
title: LocalizationValue;
16241625
paragraph: LocalizationValue;
16251626
serviceProviderFields: {

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

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import React, { type JSX } from 'react';
22

33
import { Col, descriptors, Heading, Text } from '@/customizables';
4+
import { ClipboardInput } from '@/elements/ClipboardInput';
45
import { useCardState } from '@/elements/contexts';
6+
import { Form } from '@/elements/Form';
7+
import { Checkmark, Clipboard } from '@/icons';
58
import { localizationKeys } from '@/localization';
69
import { useFormControl } from '@/ui/utils/useFormControl';
710

@@ -44,6 +47,16 @@ export const SamlGoogleConfigureSteps = (): JSX.Element => {
4447
</Step.Header>
4548
<SamlGoogleIdentityProviderMetadataStep />
4649
</Wizard.Step>
50+
51+
<Wizard.Step id='service-provider'>
52+
<Step.Header
53+
title={localizationKeys('configureSSO.configureStep.samlGoogle.mainHeaderTitle')}
54+
description={localizationKeys('configureSSO.configureStep.samlGoogle.serviceProviderStep.headerSubtitle')}
55+
>
56+
<InnerStepCounter />
57+
</Step.Header>
58+
<SamlGoogleServiceProviderStep />
59+
</Wizard.Step>
4760
</>
4861
);
4962
};
@@ -333,3 +346,109 @@ const SamlGoogleIdentityProviderMetadataStep = (): JSX.Element => {
333346
</>
334347
);
335348
};
349+
350+
const SamlGoogleServiceProviderStep = (): JSX.Element => {
351+
const { goNext, goPrev, isFirstStep, isLastStep } = useWizard();
352+
const { enterpriseConnection } = useConfigureSSO();
353+
354+
const acsUrl = enterpriseConnection?.samlConnection?.acsUrl ?? '';
355+
const spEntityId = enterpriseConnection?.samlConnection?.spEntityId ?? '';
356+
357+
const acsUrlField = useFormControl('acsUrl', acsUrl, {
358+
type: 'text',
359+
label: localizationKeys(
360+
'configureSSO.configureStep.samlGoogle.serviceProviderStep.serviceProviderFields.acsUrl.label',
361+
),
362+
isRequired: false,
363+
});
364+
const spEntityIdField = useFormControl('spEntityId', spEntityId, {
365+
type: 'text',
366+
label: localizationKeys(
367+
'configureSSO.configureStep.samlGoogle.serviceProviderStep.serviceProviderFields.spEntityId.label',
368+
),
369+
isRequired: false,
370+
});
371+
372+
return (
373+
<>
374+
<Step.Body>
375+
<Step.Section sx={theme => ({ gap: theme.space.$5 })}>
376+
<Col sx={theme => ({ gap: theme.space.$1x5 })}>
377+
<Heading
378+
elementDescriptor={descriptors.configureSSOInstructionsHeading}
379+
as='h3'
380+
textVariant='subtitle'
381+
localizationKey={localizationKeys('configureSSO.configureStep.samlGoogle.serviceProviderStep.title')}
382+
/>
383+
<Text
384+
as='p'
385+
colorScheme='secondary'
386+
localizationKey={localizationKeys('configureSSO.configureStep.samlGoogle.serviceProviderStep.paragraph')}
387+
/>
388+
</Col>
389+
390+
<Form.ControlRow elementId={acsUrlField.id}>
391+
<Form.CommonInputWrapper {...acsUrlField.props}>
392+
<ClipboardInput
393+
value={acsUrl}
394+
readOnly
395+
copyIcon={Clipboard}
396+
copiedIcon={Checkmark}
397+
/>
398+
</Form.CommonInputWrapper>
399+
</Form.ControlRow>
400+
401+
<Form.ControlRow elementId={spEntityIdField.id}>
402+
<Form.CommonInputWrapper {...spEntityIdField.props}>
403+
<ClipboardInput
404+
value={spEntityId}
405+
readOnly
406+
copyIcon={Clipboard}
407+
copiedIcon={Checkmark}
408+
/>
409+
</Form.CommonInputWrapper>
410+
</Form.ControlRow>
411+
412+
<Col
413+
elementDescriptor={descriptors.configureSSOInstructionsList}
414+
as='ul'
415+
sx={theme => ({
416+
gap: theme.space.$1x5,
417+
margin: 0,
418+
paddingInlineStart: theme.space.$5,
419+
listStyleType: 'disc',
420+
})}
421+
>
422+
<Text
423+
elementDescriptor={descriptors.configureSSOInstructionsListItem}
424+
as='li'
425+
colorScheme='secondary'
426+
localizationKey={localizationKeys(
427+
'configureSSO.configureStep.samlGoogle.serviceProviderStep.nameIdInstructions.step1',
428+
)}
429+
/>
430+
<Text
431+
elementDescriptor={descriptors.configureSSOInstructionsListItem}
432+
as='li'
433+
colorScheme='secondary'
434+
localizationKey={localizationKeys(
435+
'configureSSO.configureStep.samlGoogle.serviceProviderStep.nameIdInstructions.step2',
436+
)}
437+
/>
438+
</Col>
439+
</Step.Section>
440+
</Step.Body>
441+
442+
<Step.Footer>
443+
<Step.Footer.Previous
444+
onClick={() => goPrev()}
445+
isDisabled={isFirstStep}
446+
/>
447+
<Step.Footer.Continue
448+
onClick={() => goNext()}
449+
isDisabled={isLastStep}
450+
/>
451+
</Step.Footer>
452+
</>
453+
);
454+
};

packages/ui/src/components/ConfigureSSO/steps/ConfigureStep/saml/shared/IdentityProviderConfigurationForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ const MetadataFilePanel = ({ form, labels }: MetadataFilePanelProps): JSX.Elemen
132132
onFileChange={form.onFileChange}
133133
existingFilePresent={Boolean(form.existingFilePresent)}
134134
labels={labels}
135+
accept='.xml'
135136
/>
136137
</>
137138
);

0 commit comments

Comments
 (0)