Skip to content

Commit

Permalink
[Infra] Update deprecated access tags to the new security configurati…
Browse files Browse the repository at this point in the history
…on in routes (elastic#204214)

## Summary

Closes elastic#203793

This PR replaces the deprecated `access` tags with the new `security`
configuration.

All instances of `options: {tags: ['access:infra']}` are now updated to
`security: {authz: {requiredPrivileges: ['infra']}}`.
  • Loading branch information
iblancof authored Dec 16, 2024
1 parent 50713ca commit 73066e8
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ export class KibanaFramework {
config: InfraRouteConfig<Params, Query, Body, Method>,
handler: RequestHandler<Params, Query, Body, InfraPluginRequestHandlerContext>
) {
const defaultOptions = {
tags: ['access:infra'],
};
const defaultSecurity = { authz: { requiredPrivileges: ['infra'] } };

const routeConfig = {
path: config.path,
validate: config.validate,
Expand All @@ -65,7 +64,8 @@ export class KibanaFramework {
* using `as ...` below to ensure the route config has
* the correct options type.
*/
options: { ...config.options, ...defaultOptions },
options: { ...config.options },
security: defaultSecurity,
};
switch (config.method) {
case 'get':
Expand All @@ -89,15 +89,12 @@ export class KibanaFramework {
public registerVersionedRoute<Method extends RouteMethod = any>(
config: InfraVersionedRouteConfig<Method>
) {
const defaultOptions = {
tags: ['access:infra'],
};
const defaultSecurity = { authz: { requiredPrivileges: ['infra'] } };

const routeConfig = {
access: config.access,
path: config.path,
// Currently we have no use of custom options beyond tags, this can be extended
// beyond defaultOptions if it's needed.
options: defaultOptions,
security: defaultSecurity,
};
switch (config.method) {
case 'get':
Expand Down

0 comments on commit 73066e8

Please sign in to comment.