vault/ui/app/forms/oidc/provider.ts
Vault Automation 18ef01267b
[UI] Ember Data Migration - OIDC Providers (#14386) (#14443)
* cleanup from clients migrations

* updates oidc provider list views to use api client

* updates oidc provider details view to use api service

* adds oidc provider form class

* updates oidc provider create and edit routes to use api service and form

* updates oidc provider-form component to support form class

* updates oidc acceptance tests

* updates oidc provider delete to use api service

* test fixes

* updates search-select fallback to check if fallback component is defined

Co-authored-by: Jordan Reimer <zofskeez@gmail.com>
2026-05-01 07:47:31 -07:00

47 lines
1.7 KiB
TypeScript

/**
* Copyright IBM Corp. 2016, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
import Form from 'vault/forms/form';
import FormField from 'vault/utils/forms/field';
import FormFieldGroup from 'vault/utils/forms/field-group';
import type { Validations } from 'vault/app-types';
import type { OidcWriteProviderRequest } from '@hashicorp/vault-client-typescript';
type OidcProviderFormData = OidcWriteProviderRequest & {
name: string;
};
export default class OidcProviderForm extends Form<OidcProviderFormData> {
formFieldGroups = [
new FormFieldGroup('default', [
new FormField('name', 'string', { editDisabled: true }),
new FormField('issuer', 'string', {
subText:
"The scheme, host, and optional port for your issuer. This will be used to build the URL that validates ID tokens. Defaults to a URL with Vault's api_addr.",
placeholder: 'e.g. https://example.com:8200',
docLink: '/vault/api-docs/secret/identity/oidc-provider#create-or-update-a-provider',
}),
// SearchSelect within the FormField component works in conjunction with Ember Data Models
// we can still use the component since it supports passing in an array of objects as options for the select
// yield out the field so scopes can be fetched in the route and passed directly to SearchSelect
new FormField('supported_scopes', undefined, {
label: 'Supported scopes',
subText: 'Scopes define information about a user and the OIDC service. Optional.',
editType: 'yield',
}),
]),
];
validations: Validations = {
name: [
{ type: 'presence', message: 'Name is required.' },
{
type: 'containsWhiteSpace',
message: 'Name cannot contain whitespace.',
},
],
};
}