Skip to content

Commit 15cc971

Browse files
committed
fix(sso): drop the inert SAML algorithm selects, make NameID format clearable
The signature and digest algorithm selects were placebo controls. Tracing @better-auth/sso 1.6.23, those two values are only read by validateConfigAlgorithms, mergeSAMLConfig and sanitizeProvider — createSP and createIdP never pass them to samlify, so nothing they select reaches the SAML exchange. Bugbot separately noted they could not be cleared, since Better Auth merges with `??` and omitting a key keeps the stored value. A control that neither applies nor clears should not exist, so both are removed. NameID format is genuinely wired (createSP passes it as nameIDFormat) and is kept, but is now always sent rather than omitted when set to the provider default. samlify falsy-guards the value, so an empty string reads as unset and "Provider default" can actually clear a stored override. The read-only provider view also now shows the SP Entity ID and the ACS label for SAML — admins land there after saving and need the same two values the form says their IdP requires.
1 parent 7c3aa3b commit 15cc971

1 file changed

Lines changed: 14 additions & 58 deletions

File tree

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

Lines changed: 14 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,6 @@ const SAML_DEFAULT_MAPPING = {
6060
name: 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name',
6161
} as const
6262

63-
const SAML_SIGNATURE_ALGORITHMS = [
64-
{ label: 'Provider default', value: '' },
65-
{ label: 'RSA-SHA256', value: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' },
66-
{ label: 'RSA-SHA384', value: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384' },
67-
{ label: 'RSA-SHA512', value: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512' },
68-
] as const
69-
70-
const SAML_DIGEST_ALGORITHMS = [
71-
{ label: 'Provider default', value: '' },
72-
{ label: 'SHA-256', value: 'http://www.w3.org/2001/04/xmlenc#sha256' },
73-
{ label: 'SHA-384', value: 'http://www.w3.org/2001/04/xmldsig-more#sha384' },
74-
{ label: 'SHA-512', value: 'http://www.w3.org/2001/04/xmlenc#sha512' },
75-
] as const
76-
7763
const SAML_NAMEID_FORMATS = [
7864
{ label: 'Provider default', value: '' },
7965
{
@@ -102,8 +88,6 @@ const DEFAULT_FORM_DATA = {
10288
mapId: '',
10389
mapEmail: '',
10490
mapName: '',
105-
signatureAlgorithm: '',
106-
digestAlgorithm: '',
10791
identifierFormat: '',
10892
authorizationEndpoint: '',
10993
tokenEndpoint: '',
@@ -353,11 +337,7 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) {
353337
...(formData.callbackUrl ? { callbackUrl: formData.callbackUrl } : {}),
354338
...(formData.audience ? { audience: formData.audience } : {}),
355339
...(formData.idpMetadata ? { idpMetadata: formData.idpMetadata } : {}),
356-
...(formData.signatureAlgorithm
357-
? { signatureAlgorithm: formData.signatureAlgorithm }
358-
: {}),
359-
...(formData.digestAlgorithm ? { digestAlgorithm: formData.digestAlgorithm } : {}),
360-
...(formData.identifierFormat ? { identifierFormat: formData.identifierFormat } : {}),
340+
identifierFormat: formData.identifierFormat,
361341
}
362342

363343
await configureSSOMutation.mutateAsync(requestBody)
@@ -414,8 +394,6 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) {
414394
// that actually differs — otherwise editing would rewrite a default as an
415395
// explicit override, and a stored custom mapping must never silently reset.
416396
let mapping: { id?: string; email?: string; name?: string } = {}
417-
let signatureAlgorithm = ''
418-
let digestAlgorithm = ''
419397
let identifierFormat = ''
420398
let authorizationEndpoint = ''
421399
let tokenEndpoint = ''
@@ -439,8 +417,6 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) {
439417
wantAssertionsSigned = config.wantAssertionsSigned ?? true
440418
idpMetadata = config.idpMetadata?.metadata || config.idpMetadata || ''
441419
mapping = config.mapping ?? {}
442-
signatureAlgorithm = config.signatureAlgorithm || ''
443-
digestAlgorithm = config.digestAlgorithm || ''
444420
identifierFormat = config.identifierFormat || ''
445421
}
446422

@@ -466,8 +442,6 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) {
466442
mapId: overrideOf(mapping.id, defaults.id),
467443
mapEmail: overrideOf(mapping.email, defaults.email),
468444
mapName: overrideOf(mapping.name, defaults.name),
469-
signatureAlgorithm,
470-
digestAlgorithm,
471445
identifierFormat,
472446
authorizationEndpoint,
473447
tokenEndpoint,
@@ -514,12 +488,24 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) {
514488
</p>
515489
</SettingRow>
516490

517-
<SettingRow label='Callback URL'>
491+
<SettingRow
492+
label={
493+
existingProvider.providerType === 'saml' ? 'ACS URL (Reply URL)' : 'Callback URL'
494+
}
495+
>
518496
<ChipCopyInput value={providerCallbackUrl} copyLabel='Copy callback URL' />
519497
<p className='text-[var(--text-muted)] text-small'>
520498
Configure this in your identity provider
521499
</p>
522500
</SettingRow>
501+
502+
{/* Admins land here after saving, so this view has to carry the same
503+
two values an IdP needs as the form does. */}
504+
{existingProvider.providerType === 'saml' && (
505+
<SettingRow label='SP Entity ID'>
506+
<ChipCopyInput value={getBaseUrl()} copyLabel='Copy entity ID' />
507+
</SettingRow>
508+
)}
523509
</div>
524510
</SettingsSection>
525511
</SettingsPanel>
@@ -915,36 +901,6 @@ function OrganizationSsoSettings({ organizationId }: SSOProps) {
915901
/>
916902
</SettingRow>
917903

918-
<SettingRow label='Signature algorithm' optional>
919-
<ChipSelect
920-
align='start'
921-
value={formData.signatureAlgorithm}
922-
onChange={(value: string) =>
923-
handleInputChange('signatureAlgorithm', value)
924-
}
925-
options={SAML_SIGNATURE_ALGORITHMS.map((a) => ({
926-
label: a.label,
927-
value: a.value,
928-
}))}
929-
placeholder='Provider default'
930-
/>
931-
</SettingRow>
932-
933-
<SettingRow label='Digest algorithm' optional>
934-
<ChipSelect
935-
align='start'
936-
value={formData.digestAlgorithm}
937-
onChange={(value: string) =>
938-
handleInputChange('digestAlgorithm', value)
939-
}
940-
options={SAML_DIGEST_ALGORITHMS.map((a) => ({
941-
label: a.label,
942-
value: a.value,
943-
}))}
944-
placeholder='Provider default'
945-
/>
946-
</SettingRow>
947-
948904
<SettingRow label='NameID format' optional>
949905
<ChipSelect
950906
align='start'

0 commit comments

Comments
 (0)