mirror of
https://github.com/hashicorp/vault.git
synced 2025-09-01 12:01:10 +02:00
* [UI] Ember Data Migration - Secrets Engine Resource (#30791) * adds base factory for resources and secrets engine resource * updates dashboard and secret-engine list route to fetch mounts from api service * updates secret backends routes to use api service * updates secrets engine config routes to use api service * updates secrets backend route to use internal mounts endpoint and fixes error handling * updates property casing in config details card component * fixes dashboard tests * fixes issues with engine configuration * updates api service to only set token header if value is defined in auth service * fixes more tests * Update ui/app/routes/vault/cluster/secrets/backend/configuration/index.js Co-authored-by: Angel Garbarino <Monkeychip@users.noreply.github.com> * removes alwaysRender from publicKey field in secret engine configuration details component * removes unused hideToggle arg from secret engine mount config template * updates kv config route to load secret-engine model * fixes kv config route --------- Co-authored-by: Angel Garbarino <Monkeychip@users.noreply.github.com> * [UI] Ember Data Migration - Secrets Engine Forms (#30951) * adds secrets engine form class * updates mount-secret-backend route and form component to use secrets engine form class and api service * updates to form class proxy for nested form data properties * adds form classes for configurable secrets engines * updates secrets engine config edit route and components to use form classes and api service * adds missing copyright header * fixes tests * fixes type error * updates configure-ssh component to use form class and api service * updates configure-ssh tests * updates configuration-wif component tests * fixes mount secret backend and form tests * adds method to normalize request key casing to api service * addresses pr review feedback * removes unused secrets engine config models, adapters and serializers (#30980) * fixes azure config tests * fixes more ent tests --------- Co-authored-by: Angel Garbarino <Monkeychip@users.noreply.github.com>
102 lines
3.6 KiB
JavaScript
102 lines
3.6 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'vault/tests/helpers';
|
|
import { GENERAL } from 'vault/tests/helpers/general-selectors';
|
|
import { allEngines } from 'vault/helpers/mountable-secret-engines';
|
|
import { render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
import { CONFIGURABLE_SECRET_ENGINES } from 'vault/helpers/mountable-secret-engines';
|
|
import {
|
|
expectedConfigKeys,
|
|
expectedValueOfConfigKeys,
|
|
} from 'vault/tests/helpers/secret-engine/secret-engine-helpers';
|
|
|
|
const allEnginesArray = allEngines(); // saving as const so we don't invoke the method multiple times via the for loop
|
|
|
|
module('Integration | Component | SecretEngine::ConfigurationDetails', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.configs = {
|
|
aws: {
|
|
region: 'us-west-2',
|
|
accessKey: '123-key',
|
|
iamEndpoint: 'iam-endpoint',
|
|
stsEndpoint: 'sts-endpoint',
|
|
maxRetries: 1,
|
|
},
|
|
azure: {
|
|
clientSecret: 'client-secret',
|
|
subscriptionId: 'subscription-id',
|
|
tenantId: 'tenant-id',
|
|
clientId: 'client-id',
|
|
rootPasswordTtl: '1800000s',
|
|
environment: 'AZUREPUBLICCLOUD',
|
|
},
|
|
gcp: {
|
|
credentials: '{"some-key":"some-value"}',
|
|
ttl: '100s',
|
|
maxTtl: '101s',
|
|
},
|
|
ssh: {
|
|
publicKey: 'public-key',
|
|
generateSigningKey: true,
|
|
},
|
|
};
|
|
});
|
|
|
|
test('it shows prompt message if no config models are passed in', async function (assert) {
|
|
assert.expect(2);
|
|
await render(hbs`
|
|
<SecretEngine::ConfigurationDetails @typeDisplay="Display Name" />
|
|
`);
|
|
assert.dom(GENERAL.emptyStateTitle).hasText(`Display Name not configured`);
|
|
assert
|
|
.dom(GENERAL.emptyStateMessage)
|
|
.hasText(`Get started by configuring your Display Name secrets engine.`);
|
|
});
|
|
|
|
for (const type of CONFIGURABLE_SECRET_ENGINES) {
|
|
test(`${type}: it shows config details if configModel(s) are passed in`, async function (assert) {
|
|
this.config = this.configs[type];
|
|
this.typeDisplay = allEnginesArray.find((engine) => engine.type === type).displayName;
|
|
|
|
await render(
|
|
hbs`<SecretEngine::ConfigurationDetails @config={{this.config}} @typeDisplay={{this.typeDisplay}}/>`
|
|
);
|
|
|
|
for (const key of expectedConfigKeys(type)) {
|
|
if (
|
|
key === 'Secret key' ||
|
|
key === 'Client secret' ||
|
|
key === 'Private key' ||
|
|
key === 'Credentials'
|
|
) {
|
|
// these keys are not returned by the API and should not show on the details page
|
|
assert
|
|
.dom(GENERAL.infoRowLabel(key))
|
|
.doesNotExist(`${key} on the ${type} config details does NOT exists.`);
|
|
} else {
|
|
// check the label appears
|
|
assert.dom(GENERAL.infoRowLabel(key)).exists(`${key} on the ${type} config details exists.`);
|
|
const responseKeyAndValue = expectedValueOfConfigKeys(type, key);
|
|
// check the value appears
|
|
assert
|
|
.dom(GENERAL.infoRowValue(key))
|
|
.hasText(responseKeyAndValue, `${key} value for the ${type} config details exists.`);
|
|
// make sure the values that should be masked are masked, and others are not.
|
|
if (key === 'Public Key') {
|
|
assert.dom(GENERAL.infoRowValue(key)).hasClass('masked-input', `${key} is masked`);
|
|
} else {
|
|
assert.dom(GENERAL.infoRowValue(key)).doesNotHaveClass('masked-input', `${key} is not masked`);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|