Skip to content

Commit

Permalink
Merge branch 'main' into 80-s-asset-entity-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
klacabane authored Jun 25, 2024
2 parents 04ca789 + c47f483 commit 460f2d9
Show file tree
Hide file tree
Showing 75 changed files with 786 additions and 1,112 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ packages/kbn-search-response-warnings @elastic/kibana-data-discovery
packages/kbn-search-types @elastic/kibana-data-discovery
x-pack/plugins/searchprofiler @elastic/kibana-management
x-pack/test/security_api_integration/packages/helpers @elastic/kibana-security
x-pack/packages/security/api_key_management @elastic/kibana-security
x-pack/packages/security/form_components @elastic/kibana-security
packages/kbn-security-hardening @elastic/kibana-security
x-pack/plugins/security @elastic/kibana-security
x-pack/packages/security/plugin_types_common @elastic/kibana-security
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,8 @@
"@kbn/search-response-warnings": "link:packages/kbn-search-response-warnings",
"@kbn/search-types": "link:packages/kbn-search-types",
"@kbn/searchprofiler-plugin": "link:x-pack/plugins/searchprofiler",
"@kbn/security-api-key-management": "link:x-pack/packages/security/api_key_management",
"@kbn/security-form-components": "link:x-pack/packages/security/form_components",
"@kbn/security-hardening": "link:packages/kbn-security-hardening",
"@kbn/security-plugin": "link:x-pack/plugins/security",
"@kbn/security-plugin-types-common": "link:x-pack/packages/security/plugin_types_common",
Expand Down
8 changes: 7 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,10 @@
"@kbn/searchprofiler-plugin/*": ["x-pack/plugins/searchprofiler/*"],
"@kbn/security-api-integration-helpers": ["x-pack/test/security_api_integration/packages/helpers"],
"@kbn/security-api-integration-helpers/*": ["x-pack/test/security_api_integration/packages/helpers/*"],
"@kbn/security-api-key-management": ["x-pack/packages/security/api_key_management"],
"@kbn/security-api-key-management/*": ["x-pack/packages/security/api_key_management/*"],
"@kbn/security-form-components": ["x-pack/packages/security/form_components"],
"@kbn/security-form-components/*": ["x-pack/packages/security/form_components/*"],
"@kbn/security-hardening": ["packages/kbn-security-hardening"],
"@kbn/security-hardening/*": ["packages/kbn-security-hardening/*"],
"@kbn/security-plugin": ["x-pack/plugins/security"],
Expand Down Expand Up @@ -1872,7 +1876,9 @@
"@kbn/zod-helpers/*": ["packages/kbn-zod-helpers/*"],
// END AUTOMATED PACKAGE LISTING
// Allows for importing from `kibana` package for the exported types.
"@emotion/core": ["typings/@emotion"]
"@emotion/core": [
"typings/@emotion"
]
},
// Support .tsx files and transform JSX into calls to React.createElement
"jsx": "react",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"xpack.searchPlayground": "plugins/search_playground",
"xpack.searchInferenceEndpoints": "plugins/search_inference_endpoints",
"xpack.searchProfiler": "plugins/searchprofiler",
"xpack.security": "plugins/security",
"xpack.security": ["plugins/security", "packages/security"],
"xpack.server": "legacy/server",
"xpack.serverless": "plugins/serverless",
"xpack.serverlessSearch": "plugins/serverless_search",
Expand Down
3 changes: 3 additions & 0 deletions x-pack/packages/security/api_key_management/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/security-form-components

Contains form components used within the security plugin.
8 changes: 8 additions & 0 deletions x-pack/packages/security/api_key_management/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export * from './src/components';
16 changes: 16 additions & 0 deletions x-pack/packages/security/api_key_management/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

module.exports = {
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/x-pack/packages/security/api_key_management',
coverageReporters: ['text', 'html'],
collectCoverageFrom: ['<rootDir>/x-pack/packages/security/api_key_management/**/*.{ts,tsx}'],
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/x-pack/packages/security/api_key_management'],
};
5 changes: 5 additions & 0 deletions x-pack/packages/security/api_key_management/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-browser",
"id": "@kbn/security-api-key-management",
"owner": "@elastic/kibana-security"
}
6 changes: 6 additions & 0 deletions x-pack/packages/security/api_key_management/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/security-api-key-management",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { EuiToolTip, EuiBadge } from '@elastic/eui';
import React, { FunctionComponent } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';

export interface ApiKeyBadgeProps {
type: 'rest' | 'cross_cluster' | 'managed';
}

export const ApiKeyBadge: FunctionComponent<ApiKeyBadgeProps> = ({ type }) => {
return type === 'cross_cluster' ? (
<EuiToolTip
content={
<FormattedMessage
id="xpack.security.accountManagement.apiKeyBadge.crossClusterDescription"
defaultMessage="Allows remote clusters to connect to your local cluster."
/>
}
>
<EuiBadge color="hollow" iconType="cluster">
<FormattedMessage
id="xpack.security.accountManagement.apiKeyBadge.crossClusterLabel"
defaultMessage="Cross-Cluster"
/>
</EuiBadge>
</EuiToolTip>
) : type === 'managed' ? (
<EuiToolTip
content={
<FormattedMessage
id="xpack.security.accountManagement.apiKeyBadge.managedDescription"
defaultMessage="Created and managed by Kibana to correctly run background tasks."
/>
}
>
<EuiBadge color="hollow" iconType="gear">
<FormattedMessage
id="xpack.security.accountManagement.apiKeyBadge.managedTitle"
defaultMessage="Managed"
/>
</EuiBadge>
</EuiToolTip>
) : (
<EuiToolTip
content={
<FormattedMessage
id="xpack.security.accountManagement.apiKeyBadge.restDescription"
defaultMessage="Allows external services to access the Elastic Stack on behalf of a user."
/>
}
>
<EuiBadge color="hollow" iconType="user">
<FormattedMessage
id="xpack.security.accountManagement.apiKeyBadge.restTitle"
defaultMessage="Personal"
/>
</EuiBadge>
</EuiToolTip>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { EuiCallOut } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { FunctionComponent } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { CreateAPIKeyResult } from './api_keys_api_client';
import { SelectableTokenField } from './token_field';

export interface ApiKeyCreatedCalloutProps {
createdApiKey: CreateAPIKeyResult;
}

export const ApiKeyCreatedCallout: FunctionComponent<ApiKeyCreatedCalloutProps> = ({
createdApiKey,
}) => {
return (
<EuiCallOut
color="success"
iconType="check"
title={i18n.translate('xpack.security.management.apiKeys.createSuccessMessage', {
defaultMessage: "Created API key ''{name}''",
values: { name: createdApiKey.name },
})}
>
<p>
<FormattedMessage
id="xpack.security.management.apiKeys.successDescription"
defaultMessage="Copy this key now. You will not be able to view it again."
/>
</p>
<ApiKeySelectableTokenField createdApiKey={createdApiKey} />
</EuiCallOut>
);
};

export const ApiKeySelectableTokenField: FunctionComponent<ApiKeyCreatedCalloutProps> = ({
createdApiKey,
}) => {
const concatenated = `${createdApiKey.id}:${createdApiKey.api_key}`;
return (
<SelectableTokenField
options={[
{
key: 'encoded',
value: createdApiKey.encoded,
icon: 'empty',
label: i18n.translate('xpack.security.management.apiKeys.encodedLabel', {
defaultMessage: 'Encoded',
}),
description: i18n.translate('xpack.security.management.apiKeys.encodedDescription', {
defaultMessage: 'Format used to make requests to Elasticsearch REST API.',
}),
},
{
key: 'beats',
value: concatenated,
icon: 'logoBeats',
label: i18n.translate('xpack.security.management.apiKeys.beatsLabel', {
defaultMessage: 'Beats',
}),
description: i18n.translate('xpack.security.management.apiKeys.beatsDescription', {
defaultMessage: 'Format used to configure Beats.',
}),
},
{
key: 'logstash',
value: concatenated,
icon: 'logoLogstash',
label: i18n.translate('xpack.security.management.apiKeys.logstashLabel', {
defaultMessage: 'Logstash',
}),
description: i18n.translate('xpack.security.management.apiKeys.logstashDescription', {
defaultMessage: 'Format used to configure Logstash.',
}),
},
]}
/>
);
};
Loading

0 comments on commit 460f2d9

Please sign in to comment.