mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Deprecated authRequired in favor of security.authc.enabled (#202414)
## Summary Deprecated `authRequired` in favor of `security.authc.enabled`. ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) __Closes: https://github.com/elastic/kibana/issues/191711__ --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
62c1333303
commit
4feed672e3
3 changed files with 14 additions and 7 deletions
|
@ -368,7 +368,7 @@ export class MyPlugin implements Plugin {
|
|||
By default, when security is enabled, endpoints require the user to be authenticated to be accessed,
|
||||
and will return a `401 - Unauthorized` otherwise.
|
||||
|
||||
It is possible to disable this requirement using the `authRequired` option of the route.
|
||||
It is possible to disable this requirement using the `security.authc.enabled` option of the route.
|
||||
|
||||
```ts
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
@ -380,8 +380,11 @@ export class MyPlugin implements Plugin {
|
|||
{
|
||||
path: '/api/my_plugin/get_object',
|
||||
validate: false,
|
||||
options: {
|
||||
authRequired: false,
|
||||
security: {
|
||||
authc: {
|
||||
enabled: false,
|
||||
reason: 'This endpoint does not require authentication',
|
||||
},
|
||||
},
|
||||
},
|
||||
async (context, request, response) => {
|
||||
|
@ -394,7 +397,7 @@ export class MyPlugin implements Plugin {
|
|||
}
|
||||
```
|
||||
|
||||
Note that in addition to `true` and `false`, `authRequired` accepts a third value, `'optional'`. When used,
|
||||
Note that in addition to `true` and `false`, `security.authc.enabled` accepts a third value, `'optional'`. When used,
|
||||
Kibana will try to authenticate the user but will allow access to the endpoint regardless of the result. In that
|
||||
case, the developer needs to manually checks if the user is authenticated via `request.auth.isAuthenticated`.
|
||||
|
||||
|
@ -416,8 +419,11 @@ export class MyPlugin implements Plugin {
|
|||
{
|
||||
path: '/api/my_plugin/get_object',
|
||||
validate: false,
|
||||
options: {
|
||||
authRequired: false,
|
||||
security: {
|
||||
authc: {
|
||||
enabled: false,
|
||||
reason: 'This endpoint does not require authentication',
|
||||
},
|
||||
},
|
||||
},
|
||||
async (context, request, response) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue