kibana/x-pack/packages/security
Sid ff9a48edbe
[Security in Core] Exposes apiKeys from core.security.authc (#186910)
## Summary
Expose `apiKeys` as a service under `core.security.authc.apiKeys`.

Closes https://github.com/elastic/kibana/issues/184764

### Details
PR introduces a new API Keys Service which is accessible under the
`authc` namespace in core.security. The service exposes the public API
that was already available on the server-side in the security plugin.

The service is initialized and registered with core using the
`delegate_api` - allowing access to the service within the core plugin
without the need for the `security` plugin.

Note: I had to move quite a few types/functions around to prevent
cyclical dependencies.

### Plugins and the APIs that use the current `apiKeys` function from
the security plugin
<details>
<summary> Expand for table with details </summary>

| Plugin | File | API used | Can be migrated |
|--------|--------|--------|--------|
| alerting | x-pack/plugins/alerting/plugin/server.ts |
areApiKeysEnabled() |  |
| | x-pack/plugins/alerting/server/rules_client_factory.ts |
grantAsInternalUser() |  |
| | x-pack/plugins/alerting/server/task.ts | invalidatedAsInternalUser()
|  |
| enterprise_search |
x-pack/plugins/enterprise_search/server/routes/enterprise_search/api_keys
| create() |  |
| |
x-pack/plugins/enterprise_search/server/lib/indices/create_api_key.ts |
create() |  |
| fleet | x-pack/plugins/fleet/server/routes/setup/handlers.ts |
areApiKeysEnabled() |  |
| | x-pack/plugins/fleet/server/services/api_keys/security |
invalidateAsInternalUser() |  |
| | x-pack/plugins/fleet/server/services/api_keys/transform_api_keys.ts
| grantAsInternalUser() |  |
| |
x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.ts
| areApiKeysEnabled() |  |
| |
x-pack/plugins/fleet/server/services/setup/fleet_server_policies_enrollment_keys.ts
| areAPIKeysEnabled() |  |
| |
x-pack/plugins/observability_solution/apm/server/routes/agent_keys/get_agent_keys_privileges.ts
| areAPIKeysEnabled() |  |
| observability_solution |
x-pack/plugins/observability_solution/entity_manager/server/lib/auth/api_key/api_key.ts
| areAPIKeysEnabled |  |
| | | validate |  |
| | | grantAsInternalUser |  |
| |
x-pack/plugins/observability_solution/entity_manager/server/routes/enablement/disable.ts
| invalidateAsInternalUser |  |
| |
x-pack/plugins/observability_solution/entity_manager/server/routes/enablement/enable.ts
| invalidateAsInternalUser |  |
| |
x-pack/plugins/observability_solution/observability_onboarding/server/routes/flow/route.ts
| create |  |
| |
x-pack/plugins/observability_solution/synthetics/server/routes/synthetics_service/enablement.ts
| invalidateAsInternalUser |  |
| |
x-pack/plugins/observability_solution/synthetics/server/synthetics_service/get_api_key.ts
| validate |  |
| | | areAPIKeysEnabled |  |
| | | grantAsInternalUser |  |
| | | create |  |
| serverless_search |
x-pack/plugins/serverless_search/server/routes/api_key_routes.ts |
create |  |
| |
x-pack/plugins/transform/server/routes/api/reauthorize_transforms/route_handler_factory.ts
| grantAsInternalUser |  |
| |
x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.ts
| grantAsInternalUser |  |
| | | invalidateAsInternalUser |  |
| | | areAPIKeysEnabled() |  |
</details>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-09 23:43:17 +10:00
..
api_key_management Bump @elastic/elasticsearch to 8.14.0 (reloaded) (#186848) 2024-06-26 08:29:15 -07:00
form_components [Search] Use security plugin's API key flyout in Serverless (#186171) 2024-06-25 12:15:38 +02:00
plugin_types_common Add license check for FIPS (#181187) 2024-07-02 11:03:28 -04:00
plugin_types_public update imports for types moved to core security service packages (#187121) 2024-06-28 10:13:21 -07:00
plugin_types_server [Security in Core] Exposes apiKeys from core.security.authc (#186910) 2024-07-09 23:43:17 +10:00