3172e74d7e
* KMSE: Key Model / Adapter / Serializer setup (#13638) * First pass model * KMS key adapter (create/update), serializer, model * Add last rotated and provider to key * KeyEdit secret-edit component, and more key model stuff * add formatDate param support to infotablerow * Add keymgmt key to routes and options-for-backend * Rename keymgmt-key to keymgmt/key * Add test, cleanup * Add mirage handler for kms * Address PR comments * KMS Providers (#13797) * adds pagination-controls component * adds kms provider model, adapter and serializer * adds kms provider-edit component * updates secrets routes to handle itemType query param for kms * updates kms key adapter to query by provider * adds tests for provider-edit component * refactors kms provider adapter to account for dynamic path * adds model-validations-helper util * removes keymgmt from supported-secret-backends * fixes issue generating url for fetching keys for a provider * updates modelType method on secret-edit route to accept options object as arg rather than transition * adds additional checks to ensure queryParams are defined in options object for modelType method * UI/keymgmt distribute key (#13840) * Add distribution details on key page, and empty states if no permissions * Allow search-select component to return object so parent can tell when new item was created * Add stringarray transform * Distribute component first pass * Refactor distribute component for use with internal object rather than ember-data model * Specific permission denied errors on key edit * Allow inline errors on search-select component * Style updates for form errors * Styling and error messages on distribute component * Allow block template on inline alert so we can add doc links * Add distribute action, flash messages, cleanup * Cleanup & Add tests * More cleanup * Address PR comments * Move disable operations logic to commponent class * KMSE Enable/Config (#14835) * adds keymgmt secrets engine as supported backend * adds comment to check on keymgmt as member of adp module * updates kms provider to use model-validations decorator * fixes lint errors and tests Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
188 lines
5 KiB
JavaScript
188 lines
5 KiB
JavaScript
import { helper as buildHelper } from '@ember/component/helper';
|
|
import { capitalize } from '@ember/string';
|
|
import { assign } from '@ember/polyfills';
|
|
|
|
const DEFAULT_DISPLAY = {
|
|
searchPlaceholder: 'Filter secrets',
|
|
item: 'secret',
|
|
create: 'Create secret',
|
|
navigateTree: true,
|
|
editComponent: 'secret-edit',
|
|
listItemPartial: 'secret-list/item',
|
|
};
|
|
const SECRET_BACKENDS = {
|
|
aws: {
|
|
displayName: 'AWS',
|
|
searchPlaceholder: 'Filter roles',
|
|
item: 'role',
|
|
create: 'Create role',
|
|
navigateTree: false,
|
|
editComponent: 'role-aws-edit',
|
|
listItemPartial: 'secret-list/aws-role-item',
|
|
},
|
|
pki: {
|
|
displayName: 'PKI',
|
|
navigateTree: false,
|
|
listItemPartial: 'secret-list/pki-role-item',
|
|
tabs: [
|
|
{
|
|
name: 'roles',
|
|
label: 'Roles',
|
|
searchPlaceholder: 'Filter roles',
|
|
item: 'role',
|
|
create: 'Create role',
|
|
editComponent: 'role-pki-edit',
|
|
},
|
|
{
|
|
name: 'certs',
|
|
modelPrefix: 'cert/',
|
|
label: 'Certificates',
|
|
searchPlaceholder: 'Filter certificates',
|
|
item: 'certificates',
|
|
create: 'Create role',
|
|
tab: 'certs',
|
|
listItemPartial: 'secret-list/pki-cert-item',
|
|
editComponent: 'pki-cert-show',
|
|
},
|
|
],
|
|
},
|
|
ssh: {
|
|
displayName: 'SSH',
|
|
searchPlaceholder: 'Filter roles',
|
|
item: 'role',
|
|
create: 'Create role',
|
|
navigateTree: false,
|
|
editComponent: 'role-ssh-edit',
|
|
listItemPartial: 'secret-list/ssh-role-item',
|
|
},
|
|
database: {
|
|
displayName: 'Database',
|
|
navigateTree: false,
|
|
listItemPartial: 'secret-list/database-list-item',
|
|
hasOverview: true,
|
|
tabs: [
|
|
{
|
|
name: 'connection',
|
|
label: 'Connections',
|
|
searchPlaceholder: 'Filter connections',
|
|
item: 'connection',
|
|
create: 'Create connection',
|
|
editComponent: 'database-connection',
|
|
checkCapabilitiesPath: 'config',
|
|
},
|
|
{
|
|
name: 'role',
|
|
modelPrefix: 'role/',
|
|
label: 'Roles',
|
|
searchPlaceholder: 'Filter roles',
|
|
item: 'role',
|
|
create: 'Create role',
|
|
tab: 'role',
|
|
editComponent: 'database-role-edit',
|
|
checkCapabilitiesPath: 'roles',
|
|
},
|
|
],
|
|
},
|
|
keymgmt: {
|
|
displayName: 'Key Management',
|
|
navigateTree: false,
|
|
listItemPartial: 'secret-list/item',
|
|
tabs: [
|
|
{
|
|
name: 'key',
|
|
label: 'Keys',
|
|
searchPlaceholder: 'Filter keys',
|
|
item: 'key',
|
|
create: 'Create key',
|
|
editComponent: 'keymgmt/key-edit',
|
|
},
|
|
{
|
|
name: 'provider',
|
|
modelPrefix: 'provider/',
|
|
label: 'Providers',
|
|
searchPlaceholder: 'Filter providers',
|
|
item: 'provider',
|
|
create: 'Create provider',
|
|
tab: 'provider',
|
|
editComponent: 'keymgmt/provider-edit',
|
|
},
|
|
],
|
|
},
|
|
transform: {
|
|
displayName: 'Transformation',
|
|
navigateTree: false,
|
|
listItemPartial: 'secret-list/transform-list-item',
|
|
firstStep: 'create a transformation and a role',
|
|
tabs: [
|
|
{
|
|
name: 'transformations',
|
|
label: 'Transformations',
|
|
searchPlaceholder: 'Filter transformations',
|
|
item: 'transformation',
|
|
create: 'Create transformation',
|
|
editComponent: 'transformation-edit',
|
|
listItemPartial: 'secret-list/transform-transformation-item',
|
|
},
|
|
{
|
|
name: 'role',
|
|
modelPrefix: 'role/',
|
|
label: 'Roles',
|
|
searchPlaceholder: 'Filter roles',
|
|
item: 'role',
|
|
create: 'Create role',
|
|
tab: 'role',
|
|
editComponent: 'transform-role-edit',
|
|
},
|
|
{
|
|
name: 'template',
|
|
modelPrefix: 'template/',
|
|
label: 'Templates',
|
|
searchPlaceholder: 'Filter templates',
|
|
item: 'template',
|
|
create: 'Create template',
|
|
tab: 'template',
|
|
editComponent: 'transform-template-edit',
|
|
},
|
|
{
|
|
name: 'alphabet',
|
|
modelPrefix: 'alphabet/',
|
|
label: 'Alphabets',
|
|
searchPlaceholder: 'Filter alphabets',
|
|
item: 'alphabet',
|
|
create: 'Create alphabet',
|
|
tab: 'alphabet',
|
|
editComponent: 'alphabet-edit',
|
|
},
|
|
],
|
|
},
|
|
transit: {
|
|
searchPlaceholder: 'Filter keys',
|
|
item: 'key',
|
|
create: 'Create encryption key',
|
|
navigateTree: false,
|
|
editComponent: 'transit-edit',
|
|
listItemPartial: 'secret-list/item',
|
|
firstStep: 'create an encryption key',
|
|
},
|
|
};
|
|
|
|
export function optionsForBackend([backend, tab]) {
|
|
const selected = SECRET_BACKENDS[backend];
|
|
let backendOptions;
|
|
|
|
if (selected && selected.tabs) {
|
|
let tabData =
|
|
selected.tabs.findBy('name', tab) || selected.tabs.findBy('modelPrefix', tab) || selected.tabs[0];
|
|
backendOptions = assign({}, selected, tabData);
|
|
} else if (selected) {
|
|
backendOptions = selected;
|
|
} else {
|
|
backendOptions = assign({}, DEFAULT_DISPLAY, {
|
|
displayName: backend === 'kv' ? 'KV' : capitalize(backend),
|
|
});
|
|
}
|
|
return backendOptions;
|
|
}
|
|
|
|
export default buildHelper(optionsForBackend);
|