mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Cleanup Security plugin imports (#93056)
This commit is contained in:
parent
3c4a3b833e
commit
6ecffcc57c
505 changed files with 2502 additions and 2012 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -240,6 +240,7 @@ x-pack/plugins/telemetry_collection_xpack/schema/ @elastic/kibana-core @elastic/
|
|||
# Security
|
||||
/src/core/server/csp/ @elastic/kibana-security @elastic/kibana-core
|
||||
/src/plugins/security_oss/ @elastic/kibana-security
|
||||
/src/plugins/spaces_oss/ @elastic/kibana-security
|
||||
/test/security_functional/ @elastic/kibana-security
|
||||
/x-pack/plugins/spaces/ @elastic/kibana-security
|
||||
/x-pack/plugins/encrypted_saved_objects/ @elastic/kibana-security
|
||||
|
|
5
src/plugins/security_oss/.eslintrc.json
Normal file
5
src/plugins/security_oss/.eslintrc.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-imports": 1
|
||||
}
|
||||
}
|
|
@ -6,7 +6,8 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { coreMock } from '../../../../core/public/mocks';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
import { AppStateService } from './app_state_service';
|
||||
|
||||
describe('AppStateService', () => {
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreStart } from 'kibana/public';
|
||||
import { AppState } from '../../common';
|
||||
import type { CoreStart } from 'src/core/public';
|
||||
|
||||
import type { AppState } from '../../common';
|
||||
|
||||
const DEFAULT_APP_STATE = Object.freeze({
|
||||
insecureClusterAlert: { displayAlert: false },
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext } from 'kibana/public';
|
||||
import type { PluginInitializerContext } from 'src/core/public';
|
||||
|
||||
import { SecurityOssPlugin } from './plugin';
|
||||
|
||||
export { SecurityOssPluginSetup, SecurityOssPluginStart } from './plugin';
|
||||
|
||||
export const plugin = (initializerContext: PluginInitializerContext) =>
|
||||
new SecurityOssPlugin(initializerContext);
|
||||
|
|
|
@ -14,12 +14,13 @@ import {
|
|||
EuiSpacer,
|
||||
EuiText,
|
||||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { I18nProvider, FormattedMessage } from '@kbn/i18n/react';
|
||||
import { MountPoint } from 'kibana/public';
|
||||
import React, { useState } from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage, I18nProvider } from '@kbn/i18n/react';
|
||||
import type { MountPoint } from 'src/core/public';
|
||||
|
||||
export const defaultAlertTitle = i18n.translate('security.checkup.insecureClusterTitle', {
|
||||
defaultMessage: 'Your data is not secure',
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
InsecureClusterServiceSetup,
|
||||
InsecureClusterServiceStart,
|
||||
} from './insecure_cluster_service';
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
*/
|
||||
|
||||
import { nextTick } from '@kbn/test/jest';
|
||||
import { coreMock } from '../../../../core/public/mocks';
|
||||
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
import { mockAppStateService } from '../app_state/app_state_service.mock';
|
||||
import type { ConfigType } from '../config';
|
||||
import { InsecureClusterService } from './insecure_cluster_service';
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, MountPoint, Toast } from 'kibana/public';
|
||||
|
||||
import { BehaviorSubject, combineLatest, from } from 'rxjs';
|
||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||
|
||||
import type { CoreSetup, CoreStart, MountPoint, Toast } from 'src/core/public';
|
||||
|
||||
import type { ConfigType } from '../config';
|
||||
import type { AppStateServiceStart } from '../app_state';
|
||||
import { defaultAlertText, defaultAlertTitle } from './components';
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
*/
|
||||
|
||||
import type { DeeplyMockedKeys } from '@kbn/utility-types/jest';
|
||||
import { InsecureClusterServiceStart } from './insecure_cluster_service';
|
||||
|
||||
import type { InsecureClusterServiceStart } from './insecure_cluster_service';
|
||||
import { mockInsecureClusterService } from './insecure_cluster_service/insecure_cluster_service.mock';
|
||||
import { SecurityOssPluginSetup, SecurityOssPluginStart } from './plugin';
|
||||
import type { SecurityOssPluginSetup, SecurityOssPluginStart } from './plugin';
|
||||
|
||||
export const mockSecurityOssPlugin = {
|
||||
createSetup: () => {
|
||||
|
|
|
@ -13,13 +13,14 @@ import type {
|
|||
Plugin,
|
||||
PluginInitializerContext,
|
||||
} from 'src/core/public';
|
||||
|
||||
import { AppStateService } from './app_state';
|
||||
import type { ConfigType } from './config';
|
||||
import {
|
||||
InsecureClusterService,
|
||||
import type {
|
||||
InsecureClusterServiceSetup,
|
||||
InsecureClusterServiceStart,
|
||||
} from './insecure_cluster_service';
|
||||
import { AppStateService } from './app_state';
|
||||
import { InsecureClusterService } from './insecure_cluster_service';
|
||||
|
||||
export interface SecurityOssPluginSetup {
|
||||
insecureCluster: InsecureClusterServiceSetup;
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { elasticsearchServiceMock, loggingSystemMock } from '../../../core/server/mocks';
|
||||
import { elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks';
|
||||
|
||||
import { createClusterDataCheck } from './check_cluster_data';
|
||||
|
||||
describe('checkClusterForUserData', () => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { ElasticsearchClient, Logger } from 'kibana/server';
|
||||
import type { ElasticsearchClient, Logger } from 'src/core/server';
|
||||
|
||||
export const createClusterDataCheck = () => {
|
||||
let clusterHasUserData = false;
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
export type ConfigType = TypeOf<typeof ConfigSchema>;
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import type { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
|
||||
|
||||
import { PluginConfigDescriptor, PluginInitializerContext } from 'kibana/server';
|
||||
import { ConfigSchema } from './config';
|
||||
import { SecurityOssPlugin } from './plugin';
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { coreMock } from '../../../core/server/mocks';
|
||||
import { coreMock } from 'src/core/server/mocks';
|
||||
|
||||
import { SecurityOssPlugin } from './plugin';
|
||||
|
||||
describe('SecurityOss Plugin', () => {
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
import type {
|
||||
Capabilities,
|
||||
CoreSetup,
|
||||
|
@ -13,11 +16,11 @@ import type {
|
|||
Logger,
|
||||
Plugin,
|
||||
PluginInitializerContext,
|
||||
} from 'kibana/server';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
} from 'src/core/server';
|
||||
|
||||
import { createClusterDataCheck } from './check_cluster_data';
|
||||
import { ConfigType } from './config';
|
||||
import { setupAppStateRoute, setupAnonymousAccessCapabilitiesRoute } from './routes';
|
||||
import type { ConfigType } from './config';
|
||||
import { setupAnonymousAccessCapabilitiesRoute, setupAppStateRoute } from './routes';
|
||||
|
||||
export interface SecurityOssPluginSetup {
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { IRouter } from 'kibana/server';
|
||||
import type { IRouter } from 'src/core/server';
|
||||
|
||||
import type { AnonymousAccessService } from '../plugin';
|
||||
|
||||
interface Deps {
|
||||
|
|
|
@ -6,10 +6,13 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { IRouter, Logger } from 'kibana/server';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import type { Observable } from 'rxjs';
|
||||
import { combineLatest } from 'rxjs';
|
||||
|
||||
import type { IRouter, Logger } from 'src/core/server';
|
||||
|
||||
import type { AppState } from '../../common';
|
||||
import { createClusterDataCheck } from '../check_cluster_data';
|
||||
import type { createClusterDataCheck } from '../check_cluster_data';
|
||||
import type { ConfigType } from '../config';
|
||||
import type { AnonymousAccessService } from '../plugin';
|
||||
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { UnwrapPromise } from '@kbn/utility-types';
|
||||
import supertest from 'supertest';
|
||||
import { setupServer } from '../../../../../core/server/test_utils';
|
||||
import { AnonymousAccessService } from '../../plugin';
|
||||
|
||||
import type { UnwrapPromise } from '@kbn/utility-types';
|
||||
import { setupServer } from 'src/core/server/test_utils';
|
||||
|
||||
import type { AnonymousAccessService } from '../../plugin';
|
||||
import { setupAnonymousAccessCapabilitiesRoute } from '../anonymous_access_capabilities';
|
||||
|
||||
type SetupServerReturn = UnwrapPromise<ReturnType<typeof setupServer>>;
|
||||
|
|
|
@ -6,16 +6,18 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { loggingSystemMock } from '../../../../../core/server/mocks';
|
||||
import { setupServer } from '../../../../../core/server/test_utils';
|
||||
import { AnonymousAccessService } from '../../plugin';
|
||||
import { setupAppStateRoute } from '../app_state';
|
||||
import { ConfigType } from '../../config';
|
||||
import { BehaviorSubject, of } from 'rxjs';
|
||||
import { UnwrapPromise } from '@kbn/utility-types';
|
||||
import { createClusterDataCheck } from '../../check_cluster_data';
|
||||
import supertest from 'supertest';
|
||||
|
||||
import type { UnwrapPromise } from '@kbn/utility-types';
|
||||
import { loggingSystemMock } from 'src/core/server/mocks';
|
||||
import { setupServer } from 'src/core/server/test_utils';
|
||||
|
||||
import type { createClusterDataCheck } from '../../check_cluster_data';
|
||||
import type { ConfigType } from '../../config';
|
||||
import type { AnonymousAccessService } from '../../plugin';
|
||||
import { setupAppStateRoute } from '../app_state';
|
||||
|
||||
type SetupServerReturn = UnwrapPromise<ReturnType<typeof setupServer>>;
|
||||
const pluginId = Symbol('securityOss');
|
||||
|
||||
|
|
5
src/plugins/spaces_oss/.eslintrc.json
Normal file
5
src/plugins/spaces_oss/.eslintrc.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-imports": 1
|
||||
}
|
||||
}
|
|
@ -7,7 +7,8 @@
|
|||
*/
|
||||
|
||||
import { of } from 'rxjs';
|
||||
import { SpacesApi, SpacesApiUi, SpacesApiUiComponent } from './api';
|
||||
|
||||
import type { SpacesApi, SpacesApiUi, SpacesApiUiComponent } from './api';
|
||||
|
||||
const createApiMock = (): jest.Mocked<SpacesApi> => ({
|
||||
activeSpace$: of(),
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ReactElement } from 'react';
|
||||
import { Space } from '../common';
|
||||
|
||||
import type { Space } from '../common';
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
*/
|
||||
|
||||
import { spacesApiMock } from '../api.mock';
|
||||
import { SpacesOssPluginSetup, SpacesOssPluginStart } from '..';
|
||||
|
||||
import type { SpacesOssPluginSetup, SpacesOssPluginStart } from '../';
|
||||
|
||||
const createSetupContract = (): jest.Mocked<SpacesOssPluginSetup> => ({
|
||||
registerSpacesApi: jest.fn(),
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { Plugin } from 'src/core/public';
|
||||
import { SpacesOssPluginSetup, SpacesOssPluginStart } from './types';
|
||||
import { SpacesApi } from './api';
|
||||
import type { Plugin } from 'src/core/public';
|
||||
|
||||
import type { SpacesOssPluginSetup, SpacesOssPluginStart } from './types';
|
||||
import type { SpacesApi } from './api';
|
||||
|
||||
export class SpacesOssPlugin implements Plugin<SpacesOssPluginSetup, SpacesOssPluginStart, {}, {}> {
|
||||
private api?: SpacesApi;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { SpacesApi } from './api';
|
||||
import type { SpacesApi } from './api';
|
||||
|
||||
export interface SpacesAvailableStartContract extends SpacesApi {
|
||||
isSpacesAvailable: true;
|
||||
|
|
5
x-pack/plugins/encrypted_saved_objects/.eslintrc.json
Normal file
5
x-pack/plugins/encrypted_saved_objects/.eslintrc.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-imports": 1
|
||||
}
|
||||
}
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EncryptedSavedObjectsAuditLogger } from './audit_logger';
|
||||
import { mockAuthenticatedUser } from '../../../security/common/model/authenticated_user.mock';
|
||||
import { EncryptedSavedObjectsAuditLogger } from './audit_logger';
|
||||
|
||||
it('properly logs audit events', () => {
|
||||
const mockInternalAuditLogger = { log: jest.fn() };
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LegacyAuditLogger, AuthenticatedUser } from '../../../security/server';
|
||||
import { SavedObjectDescriptor, descriptorToArray } from '../crypto';
|
||||
import type { AuthenticatedUser, LegacyAuditLogger } from '../../../security/server';
|
||||
import type { SavedObjectDescriptor } from '../crypto';
|
||||
import { descriptorToArray } from '../crypto';
|
||||
|
||||
/**
|
||||
* Represents all audit events the plugin can log.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EncryptedSavedObjectsAuditLogger } from './audit_logger';
|
||||
import type { EncryptedSavedObjectsAuditLogger } from './audit_logger';
|
||||
|
||||
export const encryptedSavedObjectsAuditLoggerMock = {
|
||||
create() {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
export type ConfigType = TypeOf<typeof ConfigSchema>;
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SavedObjectUnsanitizedDoc } from 'kibana/server';
|
||||
import type { SavedObjectUnsanitizedDoc } from 'src/core/server';
|
||||
import { migrationMocks } from 'src/core/server/mocks';
|
||||
import { encryptedSavedObjectsServiceMock } from './crypto/index.mock';
|
||||
|
||||
import { getCreateMigration } from './create_migration';
|
||||
import { encryptedSavedObjectsServiceMock } from './crypto/index.mock';
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
SavedObjectUnsanitizedDoc,
|
||||
SavedObjectMigrationFn,
|
||||
import type {
|
||||
SavedObjectMigrationContext,
|
||||
SavedObjectMigrationFn,
|
||||
SavedObjectUnsanitizedDoc,
|
||||
} from 'src/core/server';
|
||||
import { EncryptedSavedObjectTypeRegistration, EncryptedSavedObjectsService } from './crypto';
|
||||
|
||||
import type { EncryptedSavedObjectsService, EncryptedSavedObjectTypeRegistration } from './crypto';
|
||||
import { normalizeNamespace } from './saved_objects';
|
||||
|
||||
type SavedObjectOptionalMigrationFn<InputAttributes, MigratedAttributes> = (
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service';
|
||||
import { EncryptedSavedObjectAttributesDefinition } from './encrypted_saved_object_type_definition';
|
||||
import type { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service';
|
||||
|
||||
it('correctly determines attribute properties', () => {
|
||||
const attributes = ['attr#1', 'attr#2', 'attr#3', 'attr#4'];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service';
|
||||
import type { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service';
|
||||
|
||||
/**
|
||||
* Represents the definition of the attributes of the specific saved object that are supposed to be
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
EncryptedSavedObjectsService,
|
||||
EncryptedSavedObjectTypeRegistration,
|
||||
SavedObjectDescriptor,
|
||||
|
|
|
@ -5,15 +5,16 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import nodeCrypto, { Crypto } from '@elastic/node-crypto';
|
||||
|
||||
import { mockAuthenticatedUser } from '../../../security/common/model/authenticated_user.mock';
|
||||
import { EncryptedSavedObjectsAuditLogger } from '../audit';
|
||||
import { EncryptedSavedObjectsService } from './encrypted_saved_objects_service';
|
||||
import { EncryptionError } from './encryption_error';
|
||||
import type { Crypto } from '@elastic/node-crypto';
|
||||
import nodeCrypto from '@elastic/node-crypto';
|
||||
|
||||
import { loggingSystemMock } from 'src/core/server/mocks';
|
||||
|
||||
import { mockAuthenticatedUser } from '../../../security/common/model/authenticated_user.mock';
|
||||
import type { EncryptedSavedObjectsAuditLogger } from '../audit';
|
||||
import { encryptedSavedObjectsAuditLoggerMock } from '../audit/index.mock';
|
||||
import { EncryptedSavedObjectsService } from './encrypted_saved_objects_service';
|
||||
import { EncryptionError } from './encryption_error';
|
||||
|
||||
function createNodeCryptMock(encryptionKey: string) {
|
||||
const crypto = nodeCrypto({ encryptionKey });
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Crypto, EncryptOutput } from '@elastic/node-crypto';
|
||||
import typeDetect from 'type-detect';
|
||||
import type { Crypto, EncryptOutput } from '@elastic/node-crypto';
|
||||
import stringify from 'json-stable-stringify';
|
||||
import { Logger } from 'src/core/server';
|
||||
import { AuthenticatedUser } from '../../../security/common/model';
|
||||
import { EncryptedSavedObjectsAuditLogger } from '../audit';
|
||||
import { EncryptionError, EncryptionErrorOperation } from './encryption_error';
|
||||
import typeDetect from 'type-detect';
|
||||
|
||||
import type { Logger } from 'src/core/server';
|
||||
|
||||
import type { AuthenticatedUser } from '../../../security/common/model';
|
||||
import type { EncryptedSavedObjectsAuditLogger } from '../audit';
|
||||
import { EncryptedSavedObjectAttributesDefinition } from './encrypted_saved_object_type_definition';
|
||||
import { EncryptionError, EncryptionErrorOperation } from './encryption_error';
|
||||
|
||||
/**
|
||||
* Describes the attributes to encrypt. By default, attribute values won't be exposed to end-users
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EncryptionKeyRotationService } from './encryption_key_rotation_service';
|
||||
import type { EncryptionKeyRotationService } from './encryption_key_rotation_service';
|
||||
|
||||
function createEncryptionKeyRotationServiceMock() {
|
||||
return ({ rotate: jest.fn() } as unknown) as jest.Mocked<EncryptionKeyRotationService>;
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
SavedObject,
|
||||
SavedObjectsClientContract,
|
||||
SavedObjectsServiceStart,
|
||||
} from '../../../../../src/core/server';
|
||||
import { EncryptionError, EncryptionErrorOperation } from './encryption_error';
|
||||
import { EncryptionKeyRotationService } from './encryption_key_rotation_service';
|
||||
import { EncryptedSavedObjectsService } from './encrypted_saved_objects_service';
|
||||
|
||||
} from 'src/core/server';
|
||||
import {
|
||||
coreMock,
|
||||
httpServerMock,
|
||||
loggingSystemMock,
|
||||
savedObjectsClientMock,
|
||||
savedObjectsTypeRegistryMock,
|
||||
} from '../../../../../src/core/server/mocks';
|
||||
} from 'src/core/server/mocks';
|
||||
|
||||
import type { EncryptedSavedObjectsService } from './encrypted_saved_objects_service';
|
||||
import { EncryptionError, EncryptionErrorOperation } from './encryption_error';
|
||||
import { EncryptionKeyRotationService } from './encryption_key_rotation_service';
|
||||
import { encryptedSavedObjectsServiceMock } from './index.mock';
|
||||
|
||||
function getMockSavedObject(savedObject?: Partial<SavedObject<any>>) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import {
|
||||
import type {
|
||||
ISavedObjectTypeRegistry,
|
||||
KibanaRequest,
|
||||
Logger,
|
||||
|
@ -14,9 +14,10 @@ import {
|
|||
SavedObjectsBulkUpdateObject,
|
||||
StartServicesAccessor,
|
||||
} from 'src/core/server';
|
||||
import { AuthenticatedUser, SecurityPluginSetup } from '../../../security/server';
|
||||
|
||||
import type { AuthenticatedUser, SecurityPluginSetup } from '../../../security/server';
|
||||
import { getDescriptorNamespace } from '../saved_objects/get_descriptor_namespace';
|
||||
import { EncryptedSavedObjectsService } from './encrypted_saved_objects_service';
|
||||
import type { EncryptedSavedObjectsService } from './encrypted_saved_objects_service';
|
||||
import { EncryptionError } from './encryption_error';
|
||||
|
||||
interface EncryptionKeyRotationServiceOptions {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext } from 'src/core/server';
|
||||
import type { PluginInitializerContext } from 'src/core/server';
|
||||
|
||||
import { ConfigSchema } from './config';
|
||||
import { EncryptedSavedObjectsPlugin } from './plugin';
|
||||
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin';
|
||||
import { EncryptedSavedObjectsClient, EncryptedSavedObjectsClientOptions } from './saved_objects';
|
||||
import type { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin';
|
||||
import type {
|
||||
EncryptedSavedObjectsClient,
|
||||
EncryptedSavedObjectsClientOptions,
|
||||
} from './saved_objects';
|
||||
|
||||
function createEncryptedSavedObjectsSetupMock(
|
||||
{ canEncrypt }: { canEncrypt: boolean } = { canEncrypt: false }
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EncryptedSavedObjectsPlugin } from './plugin';
|
||||
import { ConfigSchema } from './config';
|
||||
|
||||
import { coreMock } from 'src/core/server/mocks';
|
||||
|
||||
import { securityMock } from '../../security/server/mocks';
|
||||
import { ConfigSchema } from './config';
|
||||
import { EncryptedSavedObjectsPlugin } from './plugin';
|
||||
|
||||
describe('EncryptedSavedObjects Plugin', () => {
|
||||
describe('setup()', () => {
|
||||
|
|
|
@ -6,19 +6,23 @@
|
|||
*/
|
||||
|
||||
import nodeCrypto from '@elastic/node-crypto';
|
||||
import type { Logger, PluginInitializerContext, CoreSetup, Plugin } from 'src/core/server';
|
||||
|
||||
import type { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'src/core/server';
|
||||
|
||||
import type { SecurityPluginSetup } from '../../security/server';
|
||||
import { EncryptedSavedObjectsAuditLogger } from './audit';
|
||||
import type { ConfigType } from './config';
|
||||
import type { CreateEncryptedSavedObjectsMigrationFn } from './create_migration';
|
||||
import { getCreateMigration } from './create_migration';
|
||||
import type { EncryptedSavedObjectTypeRegistration } from './crypto';
|
||||
import {
|
||||
EncryptedSavedObjectsService,
|
||||
EncryptedSavedObjectTypeRegistration,
|
||||
EncryptionError,
|
||||
EncryptionKeyRotationService,
|
||||
} from './crypto';
|
||||
import { EncryptedSavedObjectsAuditLogger } from './audit';
|
||||
import { setupSavedObjects, ClientInstanciator } from './saved_objects';
|
||||
import { getCreateMigration, CreateEncryptedSavedObjectsMigrationFn } from './create_migration';
|
||||
import { defineRoutes } from './routes';
|
||||
import type { ClientInstanciator } from './saved_objects';
|
||||
import { setupSavedObjects } from './saved_objects';
|
||||
|
||||
export interface PluginsSetup {
|
||||
security?: SecurityPluginSetup;
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ConfigSchema, ConfigType } from '../config';
|
||||
import { httpServiceMock, loggingSystemMock } from 'src/core/server/mocks';
|
||||
|
||||
import { httpServiceMock, loggingSystemMock } from '../../../../../src/core/server/mocks';
|
||||
import type { ConfigType } from '../config';
|
||||
import { ConfigSchema } from '../config';
|
||||
import { encryptionKeyRotationServiceMock } from '../crypto/index.mock';
|
||||
|
||||
export const routeDefinitionParamsMock = {
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { IRouter, Logger } from '../../../../../src/core/server';
|
||||
import { ConfigType } from '../config';
|
||||
import { EncryptionKeyRotationService } from '../crypto';
|
||||
import type { IRouter, Logger } from 'src/core/server';
|
||||
|
||||
import type { ConfigType } from '../config';
|
||||
import type { EncryptionKeyRotationService } from '../crypto';
|
||||
import { defineKeyRotationRoutes } from './key_rotation';
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,18 +6,13 @@
|
|||
*/
|
||||
|
||||
import { Type } from '@kbn/config-schema';
|
||||
import {
|
||||
IRouter,
|
||||
kibanaResponseFactory,
|
||||
RequestHandler,
|
||||
RequestHandlerContext,
|
||||
RouteConfig,
|
||||
} from '../../../../../src/core/server';
|
||||
import { defineKeyRotationRoutes } from './key_rotation';
|
||||
import type { IRouter, RequestHandler, RequestHandlerContext, RouteConfig } from 'src/core/server';
|
||||
import { kibanaResponseFactory } from 'src/core/server';
|
||||
import { httpServerMock } from 'src/core/server/mocks';
|
||||
|
||||
import { httpServerMock } from '../../../../../src/core/server/mocks';
|
||||
import type { EncryptionKeyRotationService } from '../crypto';
|
||||
import { routeDefinitionParamsMock } from './index.mock';
|
||||
import { EncryptionKeyRotationService } from '../crypto';
|
||||
import { defineKeyRotationRoutes } from './key_rotation';
|
||||
|
||||
describe('Key rotation routes', () => {
|
||||
let router: jest.Mocked<IRouter>;
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { RouteDefinitionParams } from '.';
|
||||
|
||||
import type { RouteDefinitionParams } from './';
|
||||
|
||||
/**
|
||||
* The default maximum value of from + size for searches to .kibana index. Since we cannot use scroll
|
||||
|
|
|
@ -5,18 +5,19 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { SavedObjectsClientContract } from 'src/core/server';
|
||||
import { savedObjectsClientMock, savedObjectsTypeRegistryMock } from 'src/core/server/mocks';
|
||||
|
||||
import { mockAuthenticatedUser } from '../../../security/common/model/authenticated_user.mock';
|
||||
import type { EncryptedSavedObjectsService } from '../crypto';
|
||||
import { EncryptionError } from '../crypto';
|
||||
import { EncryptionErrorOperation } from '../crypto/encryption_error';
|
||||
import { SavedObjectsClientContract } from 'src/core/server';
|
||||
import { EncryptedSavedObjectsService, EncryptionError } from '../crypto';
|
||||
import { encryptedSavedObjectsServiceMock } from '../crypto/index.mock';
|
||||
import { EncryptedSavedObjectsClientWrapper } from './encrypted_saved_objects_client_wrapper';
|
||||
|
||||
import { savedObjectsClientMock, savedObjectsTypeRegistryMock } from 'src/core/server/mocks';
|
||||
import { mockAuthenticatedUser } from '../../../security/common/model/authenticated_user.mock';
|
||||
import { encryptedSavedObjectsServiceMock } from '../crypto/index.mock';
|
||||
|
||||
jest.mock('../../../../../src/core/server/saved_objects/service/lib/utils', () => {
|
||||
jest.mock('src/core/server/saved_objects/service/lib/utils', () => {
|
||||
const { SavedObjectsUtils } = jest.requireActual(
|
||||
'../../../../../src/core/server/saved_objects/service/lib/utils'
|
||||
'src/core/server/saved_objects/service/lib/utils'
|
||||
);
|
||||
return {
|
||||
SavedObjectsUtils: {
|
||||
|
|
|
@ -5,32 +5,33 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
ISavedObjectTypeRegistry,
|
||||
SavedObject,
|
||||
SavedObjectsAddToNamespacesOptions,
|
||||
SavedObjectsBaseOptions,
|
||||
SavedObjectsBulkCreateObject,
|
||||
SavedObjectsBulkGetObject,
|
||||
SavedObjectsBulkUpdateObject,
|
||||
SavedObjectsBulkResponse,
|
||||
SavedObjectsBulkUpdateObject,
|
||||
SavedObjectsBulkUpdateResponse,
|
||||
SavedObjectsCheckConflictsObject,
|
||||
SavedObjectsClientContract,
|
||||
SavedObjectsClosePointInTimeOptions,
|
||||
SavedObjectsCreateOptions,
|
||||
SavedObjectsDeleteFromNamespacesOptions,
|
||||
SavedObjectsFindOptions,
|
||||
SavedObjectsFindResponse,
|
||||
SavedObjectsOpenPointInTimeOptions,
|
||||
SavedObjectsRemoveReferencesToOptions,
|
||||
SavedObjectsRemoveReferencesToResponse,
|
||||
SavedObjectsUpdateOptions,
|
||||
SavedObjectsUpdateResponse,
|
||||
SavedObjectsAddToNamespacesOptions,
|
||||
SavedObjectsDeleteFromNamespacesOptions,
|
||||
SavedObjectsRemoveReferencesToOptions,
|
||||
ISavedObjectTypeRegistry,
|
||||
SavedObjectsRemoveReferencesToResponse,
|
||||
SavedObjectsUtils,
|
||||
} from '../../../../../src/core/server';
|
||||
import { AuthenticatedUser } from '../../../security/common/model';
|
||||
import { EncryptedSavedObjectsService } from '../crypto';
|
||||
} from 'src/core/server';
|
||||
|
||||
import { SavedObjectsUtils } from '../../../../../src/core/server';
|
||||
import type { AuthenticatedUser } from '../../../security/common/model';
|
||||
import type { EncryptedSavedObjectsService } from '../crypto';
|
||||
import { getDescriptorNamespace } from './get_descriptor_namespace';
|
||||
|
||||
interface EncryptedSavedObjectsClientOptions {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { savedObjectsTypeRegistryMock } from 'src/core/server/mocks';
|
||||
|
||||
import { getDescriptorNamespace } from './get_descriptor_namespace';
|
||||
|
||||
describe('getDescriptorNamespace', () => {
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ISavedObjectTypeRegistry, SavedObjectsUtils } from '../../../../../src/core/server';
|
||||
import type { ISavedObjectTypeRegistry } from 'src/core/server';
|
||||
|
||||
import { SavedObjectsUtils } from '../../../../../src/core/server';
|
||||
|
||||
export const getDescriptorNamespace = (
|
||||
typeRegistry: ISavedObjectTypeRegistry,
|
||||
|
|
|
@ -5,24 +5,25 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ClientInstanciator, setupSavedObjects } from '.';
|
||||
|
||||
import type {
|
||||
ISavedObjectsRepository,
|
||||
ISavedObjectTypeRegistry,
|
||||
SavedObject,
|
||||
} from 'src/core/server';
|
||||
import {
|
||||
coreMock,
|
||||
httpServerMock,
|
||||
savedObjectsClientMock,
|
||||
savedObjectsRepositoryMock,
|
||||
savedObjectsTypeRegistryMock,
|
||||
} from '../../../../../src/core/server/mocks';
|
||||
} from 'src/core/server/mocks';
|
||||
|
||||
import { securityMock } from '../../../security/server/mocks';
|
||||
import type { EncryptedSavedObjectsService } from '../crypto';
|
||||
import { encryptedSavedObjectsServiceMock } from '../crypto/index.mock';
|
||||
import type { ClientInstanciator } from './';
|
||||
import { setupSavedObjects } from './';
|
||||
import { EncryptedSavedObjectsClientWrapper } from './encrypted_saved_objects_client_wrapper';
|
||||
import {
|
||||
ISavedObjectsRepository,
|
||||
ISavedObjectTypeRegistry,
|
||||
SavedObject,
|
||||
} from '../../../../../src/core/server';
|
||||
import { EncryptedSavedObjectsService } from '../crypto';
|
||||
|
||||
describe('#setupSavedObjects', () => {
|
||||
let setupContract: ClientInstanciator;
|
||||
|
|
|
@ -6,16 +6,17 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import {
|
||||
StartServicesAccessor,
|
||||
import type {
|
||||
ISavedObjectsRepository,
|
||||
ISavedObjectTypeRegistry,
|
||||
SavedObject,
|
||||
SavedObjectsBaseOptions,
|
||||
SavedObjectsServiceSetup,
|
||||
ISavedObjectsRepository,
|
||||
ISavedObjectTypeRegistry,
|
||||
StartServicesAccessor,
|
||||
} from 'src/core/server';
|
||||
import { SecurityPluginSetup } from '../../../security/server';
|
||||
import { EncryptedSavedObjectsService } from '../crypto';
|
||||
|
||||
import type { SecurityPluginSetup } from '../../../security/server';
|
||||
import type { EncryptedSavedObjectsService } from '../crypto';
|
||||
import { EncryptedSavedObjectsClientWrapper } from './encrypted_saved_objects_client_wrapper';
|
||||
import { getDescriptorNamespace, normalizeNamespace } from './get_descriptor_namespace';
|
||||
|
||||
|
|
5
x-pack/plugins/security/.eslintrc.json
Normal file
5
x-pack/plugins/security/.eslintrc.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-imports": 1
|
||||
}
|
||||
}
|
|
@ -6,7 +6,9 @@
|
|||
*/
|
||||
|
||||
import { of } from 'rxjs';
|
||||
import { SecurityLicense, SecurityLicenseFeatures } from '.';
|
||||
|
||||
import type { SecurityLicenseFeatures } from './license_features';
|
||||
import type { SecurityLicense } from './license_service';
|
||||
|
||||
export const licenseMock = {
|
||||
create: (features?: Partial<SecurityLicenseFeatures>): jest.Mocked<SecurityLicense> => ({
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { of, BehaviorSubject } from 'rxjs';
|
||||
import { BehaviorSubject, of } from 'rxjs';
|
||||
|
||||
import { licenseMock } from '../../../licensing/common/licensing.mock';
|
||||
import { SecurityLicenseService } from './license_service';
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import type { Observable, Subscription } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ILicense, LicenseType } from '../../../licensing/common/types';
|
||||
import { SecurityLicenseFeatures } from './license_features';
|
||||
|
||||
import type { ILicense, LicenseType } from '../../../licensing/common/types';
|
||||
import type { SecurityLicenseFeatures } from './license_features';
|
||||
|
||||
export interface SecurityLicense {
|
||||
isLicenseAvailable(): boolean;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LoginLayout } from './licensing';
|
||||
import type { LoginLayout } from './licensing';
|
||||
|
||||
export interface LoginSelectorProvider {
|
||||
type: string;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AuthenticatedUser } from './authenticated_user';
|
||||
import type { AuthenticatedUser } from './authenticated_user';
|
||||
|
||||
export function mockAuthenticatedUser(user: Partial<AuthenticatedUser> = {}) {
|
||||
return {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AuthenticatedUser, canUserChangePassword } from './authenticated_user';
|
||||
import type { AuthenticatedUser } from './authenticated_user';
|
||||
import { canUserChangePassword } from './authenticated_user';
|
||||
|
||||
describe('#canUserChangePassword', () => {
|
||||
['reserved', 'native'].forEach((realm) => {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { AuthenticationProvider, User } from '.';
|
||||
import type { AuthenticationProvider } from './authentication_provider';
|
||||
import type { User } from './user';
|
||||
|
||||
const REALMS_ELIGIBLE_FOR_PASSWORD_CHANGE = ['reserved', 'native'];
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { Role } from '../../common/model';
|
||||
import {
|
||||
Role,
|
||||
isRoleEnabled,
|
||||
isRoleReserved,
|
||||
isRoleDeprecated,
|
||||
isRoleReadOnly,
|
||||
copyRole,
|
||||
prepareRoleClone,
|
||||
getExtendedRoleDeprecationNotice,
|
||||
isRoleDeprecated,
|
||||
isRoleEnabled,
|
||||
isRoleReadOnly,
|
||||
isRoleReserved,
|
||||
prepareRoleClone,
|
||||
} from '../../common/model';
|
||||
|
||||
describe('role', () => {
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
*/
|
||||
|
||||
import { cloneDeep } from 'lodash';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FeaturesPrivileges } from './features_privileges';
|
||||
|
||||
import type { FeaturesPrivileges } from './features_privileges';
|
||||
|
||||
export interface RoleIndexPrivilege {
|
||||
names: string[];
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { getUserDisplayName, User } from './user';
|
||||
import type { User } from './user';
|
||||
import { getUserDisplayName } from './user';
|
||||
|
||||
describe('#getUserDisplayName', () => {
|
||||
it(`uses the full name when available`, () => {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { parse } from 'url';
|
||||
|
||||
import { NEXT_URL_QUERY_STRING_PARAMETER } from './constants';
|
||||
import { isInternalURL } from './is_internal_url';
|
||||
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
jest.mock('./account_management_page');
|
||||
|
||||
import { AppMount, AppNavLinkStatus } from 'src/core/public';
|
||||
import { UserAPIClient } from '../management';
|
||||
import { accountManagementApp } from './account_management_app';
|
||||
import type { AppMount } from 'src/core/public';
|
||||
import { AppNavLinkStatus } from 'src/core/public';
|
||||
import { coreMock, scopedHistoryMock } from 'src/core/public/mocks';
|
||||
|
||||
import { coreMock, scopedHistoryMock } from '../../../../../src/core/public/mocks';
|
||||
import { UserAPIClient } from '../management';
|
||||
import { securityMock } from '../mocks';
|
||||
import { accountManagementApp } from './account_management_app';
|
||||
|
||||
describe('accountManagementApp', () => {
|
||||
it('properly registers application', () => {
|
||||
|
|
|
@ -6,13 +6,10 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
ApplicationSetup,
|
||||
AppMountParameters,
|
||||
AppNavLinkStatus,
|
||||
StartServicesAccessor,
|
||||
} from '../../../../../src/core/public';
|
||||
import { AuthenticationServiceSetup } from '../authentication';
|
||||
import type { ApplicationSetup, AppMountParameters, StartServicesAccessor } from 'src/core/public';
|
||||
|
||||
import { AppNavLinkStatus } from '../../../../../src/core/public';
|
||||
import type { AuthenticationServiceSetup } from '../authentication';
|
||||
|
||||
interface CreateDeps {
|
||||
application: ApplicationSetup;
|
||||
|
|
|
@ -5,15 +5,17 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { act } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { mountWithIntl, nextTick } from '@kbn/test/jest';
|
||||
import { AuthenticatedUser } from '../../common/model';
|
||||
import { AccountManagementPage } from './account_management_page';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
import type { AuthenticatedUser } from '../../common/model';
|
||||
import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock';
|
||||
import { securityMock } from '../mocks';
|
||||
import { userAPIClientMock } from '../management/users/index.mock';
|
||||
import { securityMock } from '../mocks';
|
||||
import { AccountManagementPage } from './account_management_page';
|
||||
|
||||
interface Options {
|
||||
withFullName?: boolean;
|
||||
|
|
|
@ -5,14 +5,17 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiPage, EuiPageBody, EuiPanel, EuiSpacer, EuiText } from '@elastic/eui';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { EuiPage, EuiPageBody, EuiPanel, EuiSpacer, EuiText } from '@elastic/eui';
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { CoreStart, NotificationsStart } from 'src/core/public';
|
||||
import { getUserDisplayName, AuthenticatedUser } from '../../common/model';
|
||||
import { AuthenticationServiceSetup } from '../authentication';
|
||||
import { UserAPIClient } from '../management';
|
||||
import type { CoreStart, NotificationsStart } from 'src/core/public';
|
||||
|
||||
import type { AuthenticatedUser } from '../../common/model';
|
||||
import { getUserDisplayName } from '../../common/model';
|
||||
import type { AuthenticationServiceSetup } from '../authentication';
|
||||
import type { UserAPIClient } from '../management';
|
||||
import { ChangePassword } from './change_password';
|
||||
import { PersonalInfo } from './personal_info';
|
||||
|
||||
|
|
|
@ -5,13 +5,16 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { EuiDescribedFormGroup } from '@elastic/eui';
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { NotificationsSetup } from 'src/core/public';
|
||||
import { AuthenticatedUser, canUserChangePassword } from '../../../common/model';
|
||||
import { UserAPIClient } from '../../management/users';
|
||||
import type { NotificationsSetup } from 'src/core/public';
|
||||
|
||||
import type { AuthenticatedUser } from '../../../common/model';
|
||||
import { canUserChangePassword } from '../../../common/model';
|
||||
import type { UserAPIClient } from '../../management/users';
|
||||
import { ChangePasswordForm } from '../../management/users/components/change_password_form';
|
||||
|
||||
interface Props {
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { EuiDescribedFormGroup, EuiFormRow, EuiText } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { AuthenticatedUser } from '../../../common/model';
|
||||
|
||||
import type { AuthenticatedUser } from '../../../common/model';
|
||||
|
||||
interface Props {
|
||||
user: AuthenticatedUser;
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
jest.mock('./access_agreement_page');
|
||||
|
||||
import { AppMount } from 'src/core/public';
|
||||
import { accessAgreementApp } from './access_agreement_app';
|
||||
import type { AppMount } from 'src/core/public';
|
||||
import { coreMock, scopedHistoryMock } from 'src/core/public/mocks';
|
||||
|
||||
import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks';
|
||||
import { accessAgreementApp } from './access_agreement_app';
|
||||
|
||||
describe('accessAgreementApp', () => {
|
||||
it('properly registers application', () => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public';
|
||||
import type { ApplicationSetup, AppMountParameters, StartServicesAccessor } from 'src/core/public';
|
||||
|
||||
interface CreateDeps {
|
||||
application: ApplicationSetup;
|
||||
|
|
|
@ -5,13 +5,14 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import { EuiLoadingContent } from '@elastic/eui';
|
||||
import { act } from '@testing-library/react';
|
||||
import { mountWithIntl, nextTick } from '@kbn/test/jest';
|
||||
import { findTestSubject } from '@kbn/test/jest';
|
||||
import { coreMock } from '../../../../../../src/core/public/mocks';
|
||||
import React from 'react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
|
||||
import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
import { AccessAgreementPage } from './access_agreement_page';
|
||||
|
||||
describe('AccessAgreementPage', () => {
|
||||
|
|
|
@ -7,21 +7,23 @@
|
|||
|
||||
import './access_agreement_page.scss';
|
||||
|
||||
import React, { FormEvent, MouseEvent, useCallback, useEffect, useState } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import {
|
||||
EuiButton,
|
||||
EuiPanel,
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
EuiLoadingContent,
|
||||
EuiPanel,
|
||||
EuiSpacer,
|
||||
EuiText,
|
||||
} from '@elastic/eui';
|
||||
import type { FormEvent, MouseEvent } from 'react';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public';
|
||||
import type { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public';
|
||||
|
||||
import { parseNext } from '../../../common/parse_next';
|
||||
import { AuthenticationStatePage } from '../components';
|
||||
|
|
|
@ -5,21 +5,22 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
ApplicationSetup,
|
||||
StartServicesAccessor,
|
||||
HttpSetup,
|
||||
FatalErrorsSetup,
|
||||
HttpSetup,
|
||||
StartServicesAccessor,
|
||||
} from 'src/core/public';
|
||||
import { AuthenticatedUser } from '../../common/model';
|
||||
import { ConfigType } from '../config';
|
||||
import { PluginStartDependencies } from '../plugin';
|
||||
|
||||
import type { AuthenticatedUser } from '../../common/model';
|
||||
import type { ConfigType } from '../config';
|
||||
import type { PluginStartDependencies } from '../plugin';
|
||||
import { accessAgreementApp } from './access_agreement';
|
||||
import { captureURLApp } from './capture_url';
|
||||
import { loggedOutApp } from './logged_out';
|
||||
import { loginApp } from './login';
|
||||
import { logoutApp } from './logout';
|
||||
import { loggedOutApp } from './logged_out';
|
||||
import { overwrittenSessionApp } from './overwritten_session';
|
||||
import { captureURLApp } from './capture_url';
|
||||
|
||||
interface SetupParams {
|
||||
application: ApplicationSetup;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AppMount, ScopedHistory } from 'src/core/public';
|
||||
import { captureURLApp } from './capture_url_app';
|
||||
import type { AppMount, ScopedHistory } from 'src/core/public';
|
||||
import { coreMock, scopedHistoryMock } from 'src/core/public/mocks';
|
||||
|
||||
import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks';
|
||||
import { captureURLApp } from './capture_url_app';
|
||||
|
||||
describe('captureURLApp', () => {
|
||||
beforeAll(() => {
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import { parse } from 'url';
|
||||
import { ApplicationSetup, FatalErrorsSetup, HttpSetup } from 'src/core/public';
|
||||
|
||||
import type { ApplicationSetup, FatalErrorsSetup, HttpSetup } from 'src/core/public';
|
||||
|
||||
interface CreateDeps {
|
||||
application: ApplicationSetup;
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { shallowWithIntl } from '@kbn/test/jest';
|
||||
import { AuthenticationStatePage } from './authentication_state_page';
|
||||
import React from 'react';
|
||||
|
||||
import { shallowWithIntl } from '@kbn/test/jest';
|
||||
|
||||
import { AuthenticationStatePage } from './authentication_state_page';
|
||||
|
||||
describe('AuthenticationStatePage', () => {
|
||||
it('renders', () => {
|
||||
expect(
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AuthenticationServiceSetup } from './authentication_service';
|
||||
import type { AuthenticationServiceSetup } from './authentication_service';
|
||||
|
||||
export const authenticationMock = {
|
||||
createSetup: (): jest.Mocked<AuthenticationServiceSetup> => ({
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
jest.mock('./logged_out_page');
|
||||
|
||||
import { AppMount } from 'src/core/public';
|
||||
import { loggedOutApp } from './logged_out_app';
|
||||
import type { AppMount } from 'src/core/public';
|
||||
import { coreMock, scopedHistoryMock } from 'src/core/public/mocks';
|
||||
|
||||
import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks';
|
||||
import { loggedOutApp } from './logged_out_app';
|
||||
|
||||
describe('loggedOutApp', () => {
|
||||
it('properly registers application', () => {
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
StartServicesAccessor,
|
||||
import type {
|
||||
ApplicationSetup,
|
||||
AppMountParameters,
|
||||
HttpSetup,
|
||||
StartServicesAccessor,
|
||||
} from 'src/core/public';
|
||||
|
||||
interface CreateDeps {
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { EuiButton } from '@elastic/eui';
|
||||
import { mountWithIntl } from '@kbn/test/jest';
|
||||
import { LoggedOutPage } from './logged_out_page';
|
||||
import React from 'react';
|
||||
|
||||
import { coreMock } from '../../../../../../src/core/public/mocks';
|
||||
import { mountWithIntl } from '@kbn/test/jest';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
import { LoggedOutPage } from './logged_out_page';
|
||||
|
||||
describe('LoggedOutPage', () => {
|
||||
beforeAll(() => {
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiButton } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { EuiButton } from '@elastic/eui';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { CoreStart, IBasePath } from 'src/core/public';
|
||||
import type { CoreStart, IBasePath } from 'src/core/public';
|
||||
|
||||
import { parseNext } from '../../../common/parse_next';
|
||||
import { AuthenticationStatePage } from '../components';
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import { DisabledLoginForm } from './disabled_login_form';
|
||||
|
||||
describe('DisabledLoginForm', () => {
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import { EuiPanel, EuiText } from '@elastic/eui';
|
||||
import React, { ReactNode } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import React from 'react';
|
||||
|
||||
interface Props {
|
||||
title: ReactNode;
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiButton, EuiCallOut, EuiIcon } from '@elastic/eui';
|
||||
import { act } from '@testing-library/react';
|
||||
import type { ReactWrapper } from 'enzyme';
|
||||
import React from 'react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import { act } from '@testing-library/react';
|
||||
import { EuiButton, EuiCallOut, EuiIcon } from '@elastic/eui';
|
||||
import { mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest';
|
||||
import { findTestSubject } from '@kbn/test/jest';
|
||||
import { LoginForm, PageMode } from './login_form';
|
||||
|
||||
import { coreMock } from '../../../../../../../../src/core/public/mocks';
|
||||
import { ReactWrapper } from 'enzyme';
|
||||
import { findTestSubject, mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
import { LoginForm, PageMode } from './login_form';
|
||||
|
||||
function expectPageMode(wrapper: ReactWrapper, mode: PageMode) {
|
||||
const assertions: Array<[string, boolean]> =
|
||||
|
|
|
@ -7,29 +7,32 @@
|
|||
|
||||
import './login_form.scss';
|
||||
|
||||
import React, { ChangeEvent, Component, FormEvent, Fragment, MouseEvent } from 'react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import {
|
||||
EuiButton,
|
||||
EuiIcon,
|
||||
EuiButtonEmpty,
|
||||
EuiCallOut,
|
||||
EuiFieldPassword,
|
||||
EuiFieldText,
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
EuiFormRow,
|
||||
EuiHorizontalRule,
|
||||
EuiIcon,
|
||||
EuiLink,
|
||||
EuiLoadingSpinner,
|
||||
EuiPanel,
|
||||
EuiSpacer,
|
||||
EuiText,
|
||||
EuiButtonEmpty,
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
EuiTitle,
|
||||
EuiLoadingSpinner,
|
||||
EuiLink,
|
||||
EuiHorizontalRule,
|
||||
} from '@elastic/eui';
|
||||
import type { ChangeEvent, FormEvent, MouseEvent } from 'react';
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { HttpStart, IHttpFetchError, NotificationsStart } from 'src/core/public';
|
||||
import type { HttpStart, IHttpFetchError, NotificationsStart } from 'src/core/public';
|
||||
|
||||
import type { LoginSelector, LoginSelectorProvider } from '../../../../../common/login_state';
|
||||
import { LoginValidator } from './validate_login';
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LoginValidator, LoginValidationResult } from './validate_login';
|
||||
import type { LoginValidationResult } from './validate_login';
|
||||
import { LoginValidator } from './validate_login';
|
||||
|
||||
function expectValid(result: LoginValidationResult) {
|
||||
expect(result.isInvalid).toBe(false);
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
jest.mock('./login_page');
|
||||
|
||||
import { AppMount } from 'src/core/public';
|
||||
import { loginApp } from './login_app';
|
||||
import type { AppMount } from 'src/core/public';
|
||||
import { coreMock, scopedHistoryMock } from 'src/core/public/mocks';
|
||||
|
||||
import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks';
|
||||
import { loginApp } from './login_app';
|
||||
|
||||
describe('loginApp', () => {
|
||||
it('properly registers application', () => {
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
StartServicesAccessor,
|
||||
AppMountParameters,
|
||||
import type {
|
||||
ApplicationSetup,
|
||||
AppMountParameters,
|
||||
HttpSetup,
|
||||
StartServicesAccessor,
|
||||
} from 'src/core/public';
|
||||
import { ConfigType } from '../../config';
|
||||
|
||||
import type { ConfigType } from '../../config';
|
||||
|
||||
interface CreateDeps {
|
||||
application: ApplicationSetup;
|
||||
|
|
|
@ -5,15 +5,17 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { act } from '@testing-library/react';
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import { nextTick } from '@kbn/test/jest';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
import { AUTH_PROVIDER_HINT_QUERY_STRING_PARAMETER } from '../../../common/constants';
|
||||
import { LoginState } from '../../../common/login_state';
|
||||
import { LoginPage } from './login_page';
|
||||
import { coreMock } from '../../../../../../src/core/public/mocks';
|
||||
import type { LoginState } from '../../../common/login_state';
|
||||
import { DisabledLoginForm, LoginForm } from './components';
|
||||
import { LoginPage } from './login_page';
|
||||
|
||||
const createLoginState = (options?: Partial<LoginState>) => {
|
||||
return {
|
||||
|
|
|
@ -7,21 +7,23 @@
|
|||
|
||||
import './login_page.scss';
|
||||
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSpacer, EuiTitle } from '@elastic/eui';
|
||||
import classNames from 'classnames';
|
||||
import React, { Component } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import classNames from 'classnames';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { parse } from 'url';
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSpacer, EuiTitle } from '@elastic/eui';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public';
|
||||
import type { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public';
|
||||
|
||||
import {
|
||||
AUTH_PROVIDER_HINT_QUERY_STRING_PARAMETER,
|
||||
LOGOUT_REASON_QUERY_STRING_PARAMETER,
|
||||
} from '../../../common/constants';
|
||||
import { LoginState } from '../../../common/login_state';
|
||||
import { LoginForm, DisabledLoginForm } from './components';
|
||||
import type { LoginState } from '../../../common/login_state';
|
||||
import { DisabledLoginForm, LoginForm } from './components';
|
||||
|
||||
interface Props {
|
||||
http: HttpStart;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AppMount } from 'src/core/public';
|
||||
import { logoutApp } from './logout_app';
|
||||
import type { AppMount } from 'src/core/public';
|
||||
import { coreMock, scopedHistoryMock } from 'src/core/public/mocks';
|
||||
|
||||
import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks';
|
||||
import { logoutApp } from './logout_app';
|
||||
|
||||
describe('logoutApp', () => {
|
||||
beforeAll(() => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { CoreSetup, HttpSetup } from 'src/core/public';
|
||||
import type { CoreSetup, HttpSetup } from 'src/core/public';
|
||||
|
||||
interface CreateDeps {
|
||||
application: CoreSetup['application'];
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
jest.mock('./overwritten_session_page');
|
||||
|
||||
import { AppMount } from 'src/core/public';
|
||||
import { overwrittenSessionApp } from './overwritten_session_app';
|
||||
import type { AppMount } from 'src/core/public';
|
||||
import { coreMock, scopedHistoryMock } from 'src/core/public/mocks';
|
||||
|
||||
import { coreMock, scopedHistoryMock } from '../../../../../../src/core/public/mocks';
|
||||
import { securityMock } from '../../mocks';
|
||||
import { overwrittenSessionApp } from './overwritten_session_app';
|
||||
|
||||
describe('overwrittenSessionApp', () => {
|
||||
it('properly registers application', () => {
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public';
|
||||
import { AuthenticationServiceSetup } from '../authentication_service';
|
||||
import type { ApplicationSetup, AppMountParameters, StartServicesAccessor } from 'src/core/public';
|
||||
|
||||
import type { AuthenticationServiceSetup } from '../authentication_service';
|
||||
|
||||
interface CreateDeps {
|
||||
application: ApplicationSetup;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue