-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Surface Kibana security route deprecations in Upgrade Assistant #199656
Changes from 8 commits
30442e0
b021844
9d4b9f8
e1ab95c
467039f
3544218
37d6b2e
49cec6c
3d4127b
97153f1
e5243fb
2669873
ffacbb7
533054e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
import type { TypeOf } from '@kbn/config-schema'; | ||
import { schema } from '@kbn/config-schema'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { parseNextURL } from '@kbn/std'; | ||
|
||
import type { RouteDefinitionParams } from '..'; | ||
|
@@ -40,6 +41,7 @@ export function defineCommonRoutes({ | |
'/api/security/logout', | ||
...(buildFlavor !== 'serverless' ? ['/api/security/v1/logout'] : []), | ||
]) { | ||
const isDeprecated = path === '/api/security/v1/logout'; | ||
router.get( | ||
{ | ||
path, | ||
|
@@ -57,11 +59,27 @@ export function defineCommonRoutes({ | |
excludeFromOAS: true, | ||
authRequired: false, | ||
tags: [ROUTE_TAG_CAN_REDIRECT, ROUTE_TAG_AUTH_FLOW], | ||
...(isDeprecated && { | ||
deprecated: { | ||
documentationUrl: 'https://elastic.co', // ToDo: Update with docLink to upgrade note | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the PR known and the release note added, I think we can go ahead and populate this following the template's instructions about doc links. Ditto for other instances! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jloleysens Done in 97153f1 |
||
severity: 'warning', | ||
message: i18n.translate('xpack.security.deprecations.logoutRouteMessage', { | ||
defaultMessage: | ||
'The "{path}" URL is deprecated and will be removed in the next major version, please use "/api/security/logout" instead.', | ||
jeramysoucy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
values: { path }, | ||
}), | ||
reason: { | ||
type: 'migrate', | ||
newApiMethod: 'GET', | ||
newApiPath: '/api/security/logout', | ||
}, | ||
}, | ||
}), | ||
}, | ||
}, | ||
async (context, request, response) => { | ||
const serverBasePath = basePath.serverBasePath; | ||
if (path === '/api/security/v1/logout') { | ||
if (isDeprecated) { | ||
logger.warn( | ||
`The "${serverBasePath}${path}" URL is deprecated and will stop working in the next major version, please use "${serverBasePath}/api/security/logout" URL instead.`, | ||
{ tags: ['deprecation'] } | ||
|
@@ -96,7 +114,7 @@ export function defineCommonRoutes({ | |
'/internal/security/me', | ||
...(buildFlavor !== 'serverless' ? ['/api/security/v1/me'] : []), | ||
]) { | ||
const deprecated = path === '/api/security/v1/me'; | ||
const isDeprecated = path === '/api/security/v1/me'; | ||
router.get( | ||
{ | ||
path, | ||
|
@@ -107,10 +125,24 @@ export function defineCommonRoutes({ | |
}, | ||
}, | ||
validate: false, | ||
options: { access: deprecated ? 'public' : 'internal' }, | ||
options: { | ||
access: isDeprecated ? 'public' : 'internal', | ||
...(isDeprecated && { | ||
deprecated: { | ||
documentationUrl: 'https://elastic.co', // ToDo: Update with docLink to upgrade note | ||
severity: 'warning', | ||
message: i18n.translate('xpack.security.deprecations.meRouteMessage', { | ||
defaultMessage: | ||
'The "{path}" endpoint is deprecated and will be removed in the next major version.', | ||
values: { path }, | ||
}), | ||
reason: { type: 'remove' }, | ||
}, | ||
}), | ||
}, | ||
}, | ||
createLicensedRouteHandler(async (context, request, response) => { | ||
if (deprecated) { | ||
if (isDeprecated) { | ||
logger.warn( | ||
`The "${basePath.serverBasePath}${path}" endpoint is deprecated and will be removed in the next major version.`, | ||
{ tags: ['deprecation'] } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted to remove this section as it seemed redundant with the new section. Plus it was only applicable to 8.0.0-alpha1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After #199519
main
will only contain 9.0+ changes for this file