mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
LDAP/AD Secrets Engine (#20790)
* adds ldap ember engine (#20786) * adds ldap as mountable and supported secrets engine (#20793) * removes active directory as mountable secrets engine (#20798) * LDAP Config Ember Data Setup (#20863) * adds secret-engine-path adapter * adds model, adapater and serializer for ldap config * adds test for ldap config adapter * addresses PR feedback * updates remaining instances of getURL in secrets-engine-path adapter * adds underscore to getURL method in kubernetes/config adapter * adds check config vars test for kubernetes/config adapter * adds comment regarding primaryKey in secrets-engine-path adapter * adds tab-page-header component for ldap secrets engine (#20941) * LDAP Config Route (#21059) * converts secret-mount-path service to ts and moves kubernetes fetch-config decorator to core addon and converts to ts * adds ldap config route * fixes withConfig import path in kubernetes roles route * updates types in ldap config route * adds unit tests for fetch-secret-config decorator * updates comments in fetch-secret-config decorator * renames fetch-secret-config decorator * LDAP Configure Page Component (#21384) * adds ldap page configure component * removes pauseTest and updates radio card selector in ldap config test * LDAP Configuration (#21430) * adds ldap configuration route * adds secrets-engine-mount-config component to core addon * adds ldap config-cta component * adds display fields to ldap configuration page and test * fixes ldap config-cta test * adds yield to secrets-engine-mount-config component * fixes tests * LDAP Overview Route and Page Component (#21579) * adds ldap overview route and page component * changes toolbar link action type for create role on overview page * LDAP Role Model, Adapter and Serializer (#21655) * adds model, adapter and serializer for ldap roles * addresses review feedback * changes ldap role type from tracked prop to attr and sets in adapter for query methods * adds assertions to verify that frontend only props are returned from query methods in ldap role adapter * LDAP Library Model, Adapter and Serializer (#21728) * adds model, adapter and serializer for ldap library * updates capitalization and punction for ldap role and library form fields * LDAP Roles Create and Edit (#21818) * moves stringify and jsonify helpers to core addon * adds validation error for ttl picker in form field component * adds ldap roles create and edit routes and page component * adds ldap mirage handler and factory for roles * adds example workflow to json editor component * adds tests for ldap page create and edit component * addresses feedback * LDAP Role Details (#22036) * adds ldap role route to pass down model to child routes * adds ldap role details route and page component * updates ldap role model capabilities checks * adds periods to error messages * removes modelFor from ldap roles edit and details routes * adds flash message on ldap role delete success * LDAP Roles (#22070) * adds ldap roles route and page component * update ldap role adapter tests and adds adapter options to query for partialErrorInfo * updates ldap role adapter based on PR feedback * adds filter-input component to core addon * updates ldap roles page to use filter-input component * updates ldap role adapter tests * LDAP Role Credentials (#22142) * adds ldap roles route and page component * update ldap role adapter tests and adds adapter options to query for partialErrorInfo * adds credentials actions to ldap roles list menu and fixes rotate action in details view * adds ldap role credentials route and page component * adds tests for ldap role credentials * LDAP Library Create and Edit (#22171) * adds ldap library create/edit routes and page component * adds ldap library create-and-edit tests and library mirage factory * updates form-field component to display validation errors and warnings for all fields * updates ldap library edit route class name * updates ldap library model interface name * adds missing period in flash message * LDAP Libraries (#22184) * updates interface and class names in ldap roles route * adds ldap libraries route and page component * fixes lint error * LDAP Library Details (#22200) * updates interface and class names in ldap roles route * adds ldap libraries route and page component * fixes lint error * adds ldap library details route and page component * LDAP Library Details Configuration (#22201) * updates interface and class names in ldap roles route * adds ldap libraries route and page component * fixes lint error * adds ldap library details route and page component * adds ldap library details configuration route and page component * updates ldap library check-in enforcement value mapping * fixes issue in code mirror modifier after merging upgrade * fixes failing database secrets test * LDAP Library Account Details (#22287) * adds route and page component for ldap library accounts * adds ldap component for checked out accounts * updates ldap library adapter tests * LDAP Library Check-out (#22289) * adds route and page component for ldap library accounts * adds ldap component for checked out accounts * adds route and page component for ldap library checkout * addresses PR feedback * LDAP Overview Cards (#22325) * adds overview cards to ldap overview route * adds create library toolbar action to ldap overview route * adds acceptance tests for ldap workflows (#22375) * Fetch Secrets Engine Config Decorator Docs (#22416) * removes uneccesary asyncs from ldap route model hooks * updates ldap overview route class name * adds documentation for fetch-secrets-engine-config decorator * add changelog * adding back external links, missed due to merge. * changelog * fix test after merging in dashboard work * Update 20790.txt --------- Co-authored-by: Angel Garbarino <angel@hashicorp.com> Co-authored-by: Angel Garbarino <Monkeychip@users.noreply.github.com>
This commit is contained in:
43
ui/lib/ldap/addon/routes/libraries/create.ts
Normal file
43
ui/lib/ldap/addon/routes/libraries/create.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
import type Store from '@ember-data/store';
|
||||
import type SecretMountPath from 'vault/services/secret-mount-path';
|
||||
import type LdapLibraryModel from 'vault/models/ldap/library';
|
||||
import type Controller from '@ember/controller';
|
||||
import type Transition from '@ember/routing/transition';
|
||||
import type { Breadcrumb } from 'vault/vault/app-types';
|
||||
|
||||
interface LdapLibrariesCreateController extends Controller {
|
||||
breadcrumbs: Array<Breadcrumb>;
|
||||
model: LdapLibraryModel;
|
||||
}
|
||||
|
||||
export default class LdapLibrariesCreateRoute extends Route {
|
||||
@service declare readonly store: Store;
|
||||
@service declare readonly secretMountPath: SecretMountPath;
|
||||
|
||||
model() {
|
||||
const backend = this.secretMountPath.currentPath;
|
||||
return this.store.createRecord('ldap/library', { backend });
|
||||
}
|
||||
|
||||
setupController(
|
||||
controller: LdapLibrariesCreateController,
|
||||
resolvedModel: LdapLibraryModel,
|
||||
transition: Transition
|
||||
) {
|
||||
super.setupController(controller, resolvedModel, transition);
|
||||
|
||||
controller.breadcrumbs = [
|
||||
{ label: resolvedModel.backend, route: 'overview' },
|
||||
{ label: 'libraries', route: 'libraries' },
|
||||
{ label: 'create' },
|
||||
];
|
||||
}
|
||||
}
|
||||
57
ui/lib/ldap/addon/routes/libraries/index.ts
Normal file
57
ui/lib/ldap/addon/routes/libraries/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { withConfig } from 'core/decorators/fetch-secrets-engine-config';
|
||||
import { hash } from 'rsvp';
|
||||
|
||||
import type Store from '@ember-data/store';
|
||||
import type SecretMountPath from 'vault/services/secret-mount-path';
|
||||
import type Transition from '@ember/routing/transition';
|
||||
import type LdapLibraryModel from 'vault/models/ldap/library';
|
||||
import type SecretEngineModel from 'vault/models/secret-engine';
|
||||
import type Controller from '@ember/controller';
|
||||
import type { Breadcrumb } from 'vault/vault/app-types';
|
||||
|
||||
interface LdapLibrariesRouteModel {
|
||||
backendModel: SecretEngineModel;
|
||||
promptConfig: boolean;
|
||||
libraries: Array<LdapLibraryModel>;
|
||||
}
|
||||
interface LdapLibrariesController extends Controller {
|
||||
breadcrumbs: Array<Breadcrumb>;
|
||||
model: LdapLibrariesRouteModel;
|
||||
}
|
||||
|
||||
@withConfig('ldap/config')
|
||||
export default class LdapLibrariesRoute extends Route {
|
||||
@service declare readonly store: Store;
|
||||
@service declare readonly secretMountPath: SecretMountPath;
|
||||
|
||||
declare promptConfig: boolean;
|
||||
|
||||
model() {
|
||||
const backendModel = this.modelFor('application') as SecretEngineModel;
|
||||
return hash({
|
||||
backendModel,
|
||||
promptConfig: this.promptConfig,
|
||||
libraries: this.store.query('ldap/library', { backend: backendModel.id }),
|
||||
});
|
||||
}
|
||||
|
||||
setupController(
|
||||
controller: LdapLibrariesController,
|
||||
resolvedModel: LdapLibrariesRouteModel,
|
||||
transition: Transition
|
||||
) {
|
||||
super.setupController(controller, resolvedModel, transition);
|
||||
|
||||
controller.breadcrumbs = [
|
||||
{ label: 'secrets', route: 'secrets', linkExternal: true },
|
||||
{ label: resolvedModel.backendModel.id },
|
||||
];
|
||||
}
|
||||
}
|
||||
25
ui/lib/ldap/addon/routes/libraries/library.ts
Normal file
25
ui/lib/ldap/addon/routes/libraries/library.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
import type Store from '@ember-data/store';
|
||||
import type SecretMountPath from 'vault/services/secret-mount-path';
|
||||
|
||||
interface LdapLibraryRouteParams {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export default class LdapLibraryRoute extends Route {
|
||||
@service declare readonly store: Store;
|
||||
@service declare readonly secretMountPath: SecretMountPath;
|
||||
|
||||
model(params: LdapLibraryRouteParams) {
|
||||
const backend = this.secretMountPath.currentPath;
|
||||
const { name } = params;
|
||||
return this.store.queryRecord('ldap/library', { backend, name });
|
||||
}
|
||||
}
|
||||
65
ui/lib/ldap/addon/routes/libraries/library/check-out.ts
Normal file
65
ui/lib/ldap/addon/routes/libraries/library/check-out.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import errorMessage from 'vault/utils/error-message';
|
||||
|
||||
import type FlashMessageService from 'vault/services/flash-messages';
|
||||
import type RouterService from '@ember/routing/router-service';
|
||||
import type LdapLibraryModel from 'vault/models/ldap/library';
|
||||
import type Controller from '@ember/controller';
|
||||
import type Transition from '@ember/routing/transition';
|
||||
import type { Breadcrumb } from 'vault/vault/app-types';
|
||||
import { LdapLibraryCheckOutCredentials } from 'vault/vault/adapters/ldap/library';
|
||||
import type AdapterError from 'ember-data/adapter'; // eslint-disable-line ember/use-ember-data-rfc-395-imports
|
||||
|
||||
interface LdapLibraryCheckOutController extends Controller {
|
||||
breadcrumbs: Array<Breadcrumb>;
|
||||
model: LdapLibraryCheckOutCredentials;
|
||||
}
|
||||
|
||||
export default class LdapLibraryCheckOutRoute extends Route {
|
||||
@service declare readonly flashMessages: FlashMessageService;
|
||||
@service declare readonly router: RouterService;
|
||||
|
||||
accountsRoute = 'vault.cluster.secrets.backend.ldap.libraries.library.details.accounts';
|
||||
|
||||
beforeModel(transition: Transition) {
|
||||
// transition must be from the details.accounts route to ensure it was initiated by the check-out action
|
||||
if (transition.from?.name !== this.accountsRoute) {
|
||||
this.router.replaceWith(this.accountsRoute);
|
||||
}
|
||||
}
|
||||
model(_params: object, transition: Transition) {
|
||||
const { ttl } = transition.to.queryParams;
|
||||
const library = this.modelFor('libraries.library') as LdapLibraryModel;
|
||||
return library.checkOutAccount(ttl);
|
||||
}
|
||||
setupController(
|
||||
controller: LdapLibraryCheckOutController,
|
||||
resolvedModel: LdapLibraryCheckOutCredentials,
|
||||
transition: Transition
|
||||
) {
|
||||
super.setupController(controller, resolvedModel, transition);
|
||||
|
||||
const library = this.modelFor('libraries.library') as LdapLibraryModel;
|
||||
controller.breadcrumbs = [
|
||||
{ label: library.backend, route: 'overview' },
|
||||
{ label: 'libraries', route: 'libraries' },
|
||||
{ label: library.name, route: 'libraries.library' },
|
||||
{ label: 'check-out' },
|
||||
];
|
||||
}
|
||||
|
||||
@action
|
||||
error(error: AdapterError) {
|
||||
// if check-out fails, return to library details route
|
||||
const message = errorMessage(error, 'Error checking out account. Please try again or contact support.');
|
||||
this.flashMessages.danger(message);
|
||||
this.router.replaceWith(this.accountsRoute);
|
||||
}
|
||||
}
|
||||
32
ui/lib/ldap/addon/routes/libraries/library/details.ts
Normal file
32
ui/lib/ldap/addon/routes/libraries/library/details.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
import type LdapLibraryModel from 'vault/models/ldap/library';
|
||||
import type Controller from '@ember/controller';
|
||||
import type Transition from '@ember/routing/transition';
|
||||
import type { Breadcrumb } from 'vault/vault/app-types';
|
||||
|
||||
interface LdapLibraryDetailsController extends Controller {
|
||||
breadcrumbs: Array<Breadcrumb>;
|
||||
model: LdapLibraryModel;
|
||||
}
|
||||
|
||||
export default class LdapLibraryDetailsRoute extends Route {
|
||||
setupController(
|
||||
controller: LdapLibraryDetailsController,
|
||||
resolvedModel: LdapLibraryModel,
|
||||
transition: Transition
|
||||
) {
|
||||
super.setupController(controller, resolvedModel, transition);
|
||||
|
||||
controller.breadcrumbs = [
|
||||
{ label: resolvedModel.backend, route: 'overview' },
|
||||
{ label: 'libraries', route: 'libraries' },
|
||||
{ label: resolvedModel.name },
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { hash } from 'rsvp';
|
||||
|
||||
import type LdapLibraryModel from 'vault/models/ldap/library';
|
||||
|
||||
export default class LdapLibraryRoute extends Route {
|
||||
model() {
|
||||
const model = this.modelFor('libraries.library') as LdapLibraryModel;
|
||||
return hash({
|
||||
library: model,
|
||||
statuses: model.fetchStatus(),
|
||||
});
|
||||
}
|
||||
}
|
||||
17
ui/lib/ldap/addon/routes/libraries/library/details/index.ts
Normal file
17
ui/lib/ldap/addon/routes/libraries/library/details/index.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
import type RouterService from '@ember/routing/router-service';
|
||||
|
||||
export default class LdapLibraryRoute extends Route {
|
||||
@service declare readonly router: RouterService;
|
||||
|
||||
redirect() {
|
||||
this.router.transitionTo('vault.cluster.secrets.backend.ldap.libraries.library.details.accounts');
|
||||
}
|
||||
}
|
||||
33
ui/lib/ldap/addon/routes/libraries/library/edit.ts
Normal file
33
ui/lib/ldap/addon/routes/libraries/library/edit.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
import type LdapLibraryModel from 'vault/models/ldap/library';
|
||||
import type Controller from '@ember/controller';
|
||||
import type Transition from '@ember/routing/transition';
|
||||
import type { Breadcrumb } from 'vault/vault/app-types';
|
||||
|
||||
interface LdapLibraryEditController extends Controller {
|
||||
breadcrumbs: Array<Breadcrumb>;
|
||||
model: LdapLibraryModel;
|
||||
}
|
||||
|
||||
export default class LdapLibraryEditRoute extends Route {
|
||||
setupController(
|
||||
controller: LdapLibraryEditController,
|
||||
resolvedModel: LdapLibraryModel,
|
||||
transition: Transition
|
||||
) {
|
||||
super.setupController(controller, resolvedModel, transition);
|
||||
|
||||
controller.breadcrumbs = [
|
||||
{ label: resolvedModel.backend, route: 'overview' },
|
||||
{ label: 'libraries', route: 'libraries' },
|
||||
{ label: resolvedModel.name, route: 'libraries.library.details' },
|
||||
{ label: 'edit' },
|
||||
];
|
||||
}
|
||||
}
|
||||
17
ui/lib/ldap/addon/routes/libraries/library/index.ts
Normal file
17
ui/lib/ldap/addon/routes/libraries/library/index.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
import type RouterService from '@ember/routing/router-service';
|
||||
|
||||
export default class LdapLibraryRoute extends Route {
|
||||
@service declare readonly router: RouterService;
|
||||
|
||||
redirect() {
|
||||
this.router.transitionTo('vault.cluster.secrets.backend.ldap.libraries.library.details');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user