Skip to content

Commit 23beefe

Browse files
authored
Add help text + request signing section header to IdP form (#2537)
* Add request signing section header to IdP form * help text in the identity provider form? in this economy? * review feedback, test login path preview
1 parent 48693a2 commit 23beefe

File tree

3 files changed

+52
-7
lines changed

3 files changed

+52
-7
lines changed

app/forms/idp/create.tsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ import { useSiloSelector } from '~/hooks/use-params'
2121
import { addToast } from '~/stores/toast'
2222
import { Checkbox } from '~/ui/lib/Checkbox'
2323
import { FormDivider } from '~/ui/lib/Divider'
24+
import { Message } from '~/ui/lib/Message'
2425
import { SideModal } from '~/ui/lib/SideModal'
2526
import { readBlobAsBase64 } from '~/util/file'
27+
import { links } from '~/util/links'
2628
import { pb } from '~/util/path-builder'
2729

2830
import { MetadataSourceField, type IdpCreateFormValues } from './shared'
@@ -128,7 +130,35 @@ export function CreateIdpSideModalForm() {
128130
submitError={createIdp.error}
129131
submitLabel="Create provider"
130132
>
131-
<NameField name="name" control={form.control} />
133+
<Message
134+
content={
135+
<>
136+
Read the{' '}
137+
<a
138+
href={links.identityProvidersDocs}
139+
className="underline"
140+
target="_blank"
141+
rel="noreferrer"
142+
>
143+
Rack Configuration
144+
</a>{' '}
145+
guide to learn more about setting up an identity provider.
146+
</>
147+
}
148+
/>
149+
<NameField
150+
name="name"
151+
control={form.control}
152+
description={
153+
<>
154+
A short name for the provider in our system. Users will see it in the path to
155+
the login page:{' '}
156+
<code>
157+
/login/{silo}/saml/{name.trim() || 'idp-name'}
158+
</code>
159+
</>
160+
}
161+
/>
132162
<DescriptionField name="description" control={form.control} required />
133163
<TextField
134164
name="technicalContactEmail"
@@ -179,14 +209,17 @@ export function CreateIdpSideModalForm() {
179209
control={form.control}
180210
/>
181211

212+
<FormDivider />
213+
214+
<SideModal.Heading>Request signing</SideModal.Heading>
182215
{/* We don't bother validating that you have both of these or neither even
183216
though the API requires that because we are going to change the API to
184217
always require both, at which point these become simple `required` fields */}
185218
<FileField
186219
id="public-cert-file-input"
187220
name="signingKeypair.publicCert"
188221
description="DER-encoded X.509 certificate"
189-
label="Public cert"
222+
label="Public certificate"
190223
control={form.control}
191224
/>
192225
<FileField

app/ui/lib/Message.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const Message = ({
7171
// TODO: convert content to a children prop
7272
content,
7373
className,
74-
variant = 'success',
74+
variant = 'info',
7575
cta,
7676
icon,
7777
}: MessageProps) => {

test/e2e/silos.e2e.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ test('Default silo', async ({ page }) => {
171171
page.getByText('Silo viewerFleet viewer'),
172172
])
173173
})
174+
174175
test('Identity providers', async ({ page }) => {
175176
await page.goto('/system/silos/maze-war')
176177

@@ -199,21 +200,32 @@ test('Identity providers', async ({ page }) => {
199200

200201
await expect(dialog).toBeVisible()
201202

202-
const nameField = dialog.getByLabel('Name', { exact: true })
203-
const acsUrlField = dialog.getByLabel('ACS URL', { exact: true })
203+
// test login URL preview in name field description
204+
await expect(page.getByText('login page: /login/maze-war/saml/idp-name')).toBeVisible()
204205

206+
const nameField = dialog.getByLabel('Name', { exact: true })
205207
await nameField.fill('test-provider')
208+
209+
// preview updates as you type
210+
await expect(
211+
page.getByText('login page: /login/maze-war/saml/test-provider')
212+
).toBeVisible()
213+
206214
// ACS URL should be populated with generated value
215+
const acsUrlField = dialog.getByLabel('ACS URL', { exact: true })
207216
const acsUrl = 'https://maze-war.sys.placeholder/login/maze-war/saml/test-provider'
208217
await expect(acsUrlField).toHaveValue(acsUrl)
209218

219+
const acsUrlCheckbox = dialog.getByRole('checkbox', { name: 'Use standard ACS URL' })
220+
await expect(acsUrlCheckbox).toBeChecked()
221+
210222
// uncheck the box and change the value
211-
await dialog.getByRole('checkbox', { name: 'Use standard ACS URL' }).click()
223+
await acsUrlCheckbox.click()
212224
await acsUrlField.fill('https://example.com')
213225
await expect(acsUrlField).toHaveValue('https://example.com')
214226

215227
// re-check the box and verify that the value is regenerated
216-
await dialog.getByRole('checkbox', { name: 'Use standard ACS URL' }).click()
228+
await acsUrlCheckbox.click()
217229
await expect(acsUrlField).toHaveValue(acsUrl)
218230

219231
await page.getByRole('button', { name: 'Create provider' }).click()

0 commit comments

Comments
 (0)