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:
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
/**
|
||||
* the overview, configure, configuration and roles routes all need to be aware of the config for the engine
|
||||
* if the user has not configured they are prompted to do so in each of the routes
|
||||
* decorate the necessary routes to perform the check in the beforeModel hook since that may change what is returned for the model
|
||||
*/
|
||||
|
||||
export function withConfig() {
|
||||
return function decorator(SuperClass) {
|
||||
if (!Object.prototype.isPrototypeOf.call(Route, SuperClass)) {
|
||||
// eslint-disable-next-line
|
||||
console.error(
|
||||
'withConfig decorator must be used on an instance of ember Route class. Decorator not applied to returned class'
|
||||
);
|
||||
return SuperClass;
|
||||
}
|
||||
return class FetchConfig extends SuperClass {
|
||||
configModel = null;
|
||||
configError = null;
|
||||
promptConfig = false;
|
||||
|
||||
async beforeModel() {
|
||||
super.beforeModel(...arguments);
|
||||
|
||||
const backend = this.secretMountPath.get();
|
||||
// check the store for record first
|
||||
this.configModel = this.store.peekRecord('kubernetes/config', backend);
|
||||
if (!this.configModel) {
|
||||
return this.store
|
||||
.queryRecord('kubernetes/config', { backend })
|
||||
.then((record) => {
|
||||
this.configModel = record;
|
||||
this.promptConfig = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
// we need to ignore if the user does not have permission or other failures so as to not block the other operations
|
||||
if (error.httpStatus === 404) {
|
||||
this.promptConfig = true;
|
||||
} else {
|
||||
// not considering 404 an error since it triggers the cta
|
||||
// this error is thrown in the configuration route so we can display the error in the view
|
||||
this.configError = error;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.promptConfig = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { withConfig } from '../decorators/fetch-config';
|
||||
import { withConfig } from 'core/decorators/fetch-secrets-engine-config';
|
||||
|
||||
@withConfig()
|
||||
@withConfig('kubernetes/config')
|
||||
export default class KubernetesConfigureRoute extends Route {
|
||||
@service store;
|
||||
@service secretMountPath;
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { withConfig } from '../decorators/fetch-config';
|
||||
import { withConfig } from 'core/decorators/fetch-secrets-engine-config';
|
||||
|
||||
@withConfig()
|
||||
@withConfig('kubernetes/config')
|
||||
export default class KubernetesConfigureRoute extends Route {
|
||||
@service store;
|
||||
@service secretMountPath;
|
||||
|
||||
async model() {
|
||||
const backend = this.secretMountPath.get();
|
||||
const backend = this.secretMountPath.currentPath;
|
||||
return this.configModel || this.store.createRecord('kubernetes/config', { backend });
|
||||
}
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { withConfig } from 'kubernetes/decorators/fetch-config';
|
||||
import { withConfig } from 'core/decorators/fetch-secrets-engine-config';
|
||||
import { hash } from 'rsvp';
|
||||
|
||||
@withConfig()
|
||||
@withConfig('kubernetes/config')
|
||||
export default class KubernetesOverviewRoute extends Route {
|
||||
@service store;
|
||||
@service secretMountPath;
|
||||
|
||||
async model() {
|
||||
const backend = this.secretMountPath.get();
|
||||
const backend = this.secretMountPath.currentPath;
|
||||
return hash({
|
||||
promptConfig: this.promptConfig,
|
||||
backend: this.modelFor('application'),
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class KubernetesRolesCreateRoute extends Route {
|
||||
@service secretMountPath;
|
||||
|
||||
model() {
|
||||
const backend = this.secretMountPath.get();
|
||||
const backend = this.secretMountPath.currentPath;
|
||||
return this.store.createRecord('kubernetes/role', { backend });
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { withConfig } from 'kubernetes/decorators/fetch-config';
|
||||
import { withConfig } from 'core/decorators/fetch-secrets-engine-config';
|
||||
import { hash } from 'rsvp';
|
||||
|
||||
@withConfig()
|
||||
@withConfig('kubernetes/config')
|
||||
export default class KubernetesRolesRoute extends Route {
|
||||
@service store;
|
||||
@service secretMountPath;
|
||||
@@ -17,7 +17,7 @@ export default class KubernetesRolesRoute extends Route {
|
||||
// filter roles based on pageFilter value
|
||||
const { pageFilter } = transition.to.queryParams;
|
||||
const roles = this.store
|
||||
.query('kubernetes/role', { backend: this.secretMountPath.get() })
|
||||
.query('kubernetes/role', { backend: this.secretMountPath.currentPath })
|
||||
.then((models) =>
|
||||
pageFilter
|
||||
? models.filter((model) => model.name.toLowerCase().includes(pageFilter.toLowerCase()))
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class KubernetesRoleCredentialsRoute extends Route {
|
||||
model() {
|
||||
return {
|
||||
roleName: this.paramsFor('roles.role').name,
|
||||
backend: this.secretMountPath.get(),
|
||||
backend: this.secretMountPath.currentPath,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class KubernetesRoleDetailsRoute extends Route {
|
||||
@service secretMountPath;
|
||||
|
||||
model() {
|
||||
const backend = this.secretMountPath.get();
|
||||
const backend = this.secretMountPath.currentPath;
|
||||
const { name } = this.paramsFor('roles.role');
|
||||
return this.store.queryRecord('kubernetes/role', { backend, name });
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class KubernetesRoleEditRoute extends Route {
|
||||
@service secretMountPath;
|
||||
|
||||
model() {
|
||||
const backend = this.secretMountPath.get();
|
||||
const backend = this.secretMountPath.currentPath;
|
||||
const { name } = this.paramsFor('roles.role');
|
||||
return this.store.queryRecord('kubernetes/role', { backend, name });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user