kibana/test/plugin_functional/plugins/rendering_plugin/server/plugin.ts
Joe Portner 6ba02ec7d6
[7.17] Test config settings that are exposed to the browser (#129438) (#129857)
* Test config settings that are exposed to the browser (#129438)

(cherry picked from commit 27ff7d3424)

# Conflicts:
#	.github/CODEOWNERS
#	packages/kbn-config-schema/src/index.ts

* Enable security plugin in OSS tests

This is a partial backport of #111681, so the Kibana security
plugin is enabled but Elasticsearch security is still disabled.

* Fix exposed config key tests

The exposed config keys are slightly different in the 7.17 branch.

* Fix UI Capabilities tests

The enterpriseSearch plugin does not have a required dependency on
the security plugin in the 7.17 branch, so our bacported
assertions for these tests needed to change accordingly.
2022-04-11 10:31:45 -07:00

44 lines
1.2 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { Plugin, CoreSetup } from 'kibana/server';
import { schema } from '@kbn/config-schema';
export class RenderingPlugin implements Plugin {
public setup(core: CoreSetup) {
core.http.resources.register(
{
path: '/render/{id}',
validate: {
query: schema.object(
{
isAnonymousPage: schema.boolean({ defaultValue: false }),
},
{ unknowns: 'allow' }
),
params: schema.object({
id: schema.maybe(schema.string()),
}),
},
},
async (context, req, res) => {
const { isAnonymousPage } = req.query;
if (isAnonymousPage) {
return res.renderAnonymousCoreApp({ includeExposedConfigKeys: true });
}
return res.renderCoreApp({ includeExposedConfigKeys: true });
}
);
}
public start() {}
public stop() {}
}