Skip to content

Commit 833932a

Browse files
committed
fix(sso): stop the provider ID being editable after it is saved
Renaming it was never useful and always destructive. The value forms the redirect URL registered with the identity provider, so changing it breaks sign-in until the IdP is updated. Worse, the register route selects create-vs-update by (providerId, organizationId), so a renamed id misses and registers a SECOND provider; the settings page renders providers[0], so the duplicate is invisible, there is no delete action to remove it, and existing account rows still reference the old id. Editing now shows it as a read-only copyable value, and the create form says up front that it cannot be changed later. Also hoists the suggestion list to module scope — it was rebuilding 44 objects on every keystroke anywhere in the form.
1 parent db92d43 commit 833932a

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

apps/sim/ee/sso/components/sso-settings.tsx

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ const SAML_NAMEID_FORMATS = [
6767
{ label: 'Unspecified', value: 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified' },
6868
] as const
6969

70+
const PROVIDER_ID_SUGGESTIONS = SSO_TRUSTED_PROVIDERS.map((id) => ({ label: id, value: id }))
71+
7072
const DEFAULT_FORM_DATA = {
7173
providerType: 'oidc' as 'oidc' | 'saml',
7274
providerId: '',
@@ -563,20 +565,30 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) {
563565
showErrors && errors.providerId.length > 0 ? errors.providerId.join(' ') : undefined
564566
}
565567
>
566-
<ChipCombobox
567-
value={formData.providerId}
568-
onChange={(value: string) => handleInputChange('providerId', value)}
569-
options={SSO_TRUSTED_PROVIDERS.map((id) => ({
570-
label: id,
571-
value: id,
572-
}))}
573-
placeholder='Select or enter a provider ID'
574-
editable
575-
/>
576-
<p className='text-[var(--text-muted)] text-small'>
577-
Must be unique across all Sim organizations — include something specific to you,
578-
like <span className='font-mono'>azure-ad-acme</span>.
579-
</p>
568+
{isEditing ? (
569+
<>
570+
<ChipCopyInput value={formData.providerId} copyLabel='Copy provider ID' />
571+
<p className='text-[var(--text-muted)] text-small'>
572+
Fixed once saved — it forms the redirect URL registered with your identity
573+
provider.
574+
</p>
575+
</>
576+
) : (
577+
<>
578+
<ChipCombobox
579+
value={formData.providerId}
580+
onChange={(value: string) => handleInputChange('providerId', value)}
581+
options={PROVIDER_ID_SUGGESTIONS}
582+
placeholder='Select or enter a provider ID'
583+
editable
584+
/>
585+
<p className='text-[var(--text-muted)] text-small'>
586+
Must be unique across all Sim organizations — include something specific to you,
587+
like <span className='font-mono'>azure-ad-acme</span>. It cannot be changed
588+
later.
589+
</p>
590+
</>
591+
)}
580592
</SettingRow>
581593

582594
<SettingRow

0 commit comments

Comments
 (0)