f38a50b6b2
* fetch auth methods when going to the auth route and pass them to the auth form component * add boolean editType for form-fields * look in the data hash in the serializer * remove renderInPlace for info-tooltips as it does something goofy with widths * add new fields for auth methods * fix console refresh command on routes that use lazyPaginatedQuery * add wrapped_token param that logs you in via the token backend and show other backends if your list contains supported ones * handle casing when looking up supported backends * change listingVisibility to match the new API * move wrapped_token up to the vault route level so it works from the app root
24 lines
872 B
JavaScript
24 lines
872 B
JavaScript
import ApplicationAdapter from './application';
|
|
|
|
const WRAPPING_ENDPOINTS = ['lookup', 'wrap', 'unwrap', 'rewrap'];
|
|
const TOOLS_ENDPOINTS = ['random', 'hash'];
|
|
|
|
export default ApplicationAdapter.extend({
|
|
toolUrlFor(action) {
|
|
const isWrapping = WRAPPING_ENDPOINTS.includes(action);
|
|
const isTool = TOOLS_ENDPOINTS.includes(action);
|
|
const prefix = isWrapping ? 'wrapping' : 'tools';
|
|
if (!isWrapping && !isTool) {
|
|
throw new Error(`Calls to a ${action} endpoint are not currently allowed in the tool adapter`);
|
|
}
|
|
return `${this.buildURL()}/${prefix}/${action}`;
|
|
},
|
|
|
|
toolAction(action, data, options = {}) {
|
|
const { wrapTTL, clientToken } = options;
|
|
const url = this.toolUrlFor(action);
|
|
const ajaxOptions = wrapTTL ? { data, wrapTTL, clientToken } : { data, clientToken };
|
|
return this.ajax(url, 'POST', ajaxOptions);
|
|
},
|
|
});
|