mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Unify Security and EncryptedSavedObjects public contract names according to NP migration guide. (#56597)
This commit is contained in:
parent
598968f20f
commit
8def60e1da
25 changed files with 64 additions and 65 deletions
|
@ -29,7 +29,7 @@ import {
|
|||
CreateAPIKeyResult as SecurityPluginCreateAPIKeyResult,
|
||||
InvalidateAPIKeyResult as SecurityPluginInvalidateAPIKeyResult,
|
||||
} from '../../../../plugins/security/server';
|
||||
import { PluginStartContract as EncryptedSavedObjectsStartContract } from '../../../../plugins/encrypted_saved_objects/server';
|
||||
import { EncryptedSavedObjectsPluginStart } from '../../../../plugins/encrypted_saved_objects/server';
|
||||
import { TaskManagerStartContract } from '../../../../plugins/task_manager/server';
|
||||
|
||||
type NormalizedAlertAction = Omit<AlertAction, 'actionTypeId'>;
|
||||
|
@ -45,7 +45,7 @@ interface ConstructorOptions {
|
|||
taskManager: TaskManagerStartContract;
|
||||
savedObjectsClient: SavedObjectsClientContract;
|
||||
alertTypeRegistry: AlertTypeRegistry;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsStartContract;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsPluginStart;
|
||||
spaceId?: string;
|
||||
namespace?: string;
|
||||
getUserName: () => Promise<string | null>;
|
||||
|
@ -120,7 +120,7 @@ export class AlertsClient {
|
|||
private readonly invalidateAPIKey: (
|
||||
params: InvalidateAPIKeyParams
|
||||
) => Promise<InvalidateAPIKeyResult>;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsStartContract;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsPluginStart;
|
||||
|
||||
constructor({
|
||||
alertTypeRegistry,
|
||||
|
|
|
@ -11,7 +11,7 @@ import { AlertTypeRegistry, SpaceIdToNamespaceFunction } from './types';
|
|||
import { SecurityPluginStartContract } from './shim';
|
||||
import { KibanaRequest, Logger } from '../../../../../src/core/server';
|
||||
import { InvalidateAPIKeyParams } from '../../../../plugins/security/server';
|
||||
import { PluginStartContract as EncryptedSavedObjectsStartContract } from '../../../../plugins/encrypted_saved_objects/server';
|
||||
import { EncryptedSavedObjectsPluginStart } from '../../../../plugins/encrypted_saved_objects/server';
|
||||
import { TaskManagerStartContract } from '../../../../plugins/task_manager/server';
|
||||
|
||||
export interface ConstructorOpts {
|
||||
|
@ -21,7 +21,7 @@ export interface ConstructorOpts {
|
|||
securityPluginSetup?: SecurityPluginStartContract;
|
||||
getSpaceId: (request: Hapi.Request) => string | undefined;
|
||||
spaceIdToNamespace: SpaceIdToNamespaceFunction;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsStartContract;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsPluginStart;
|
||||
}
|
||||
|
||||
export class AlertsClientFactory {
|
||||
|
@ -31,7 +31,7 @@ export class AlertsClientFactory {
|
|||
private readonly securityPluginSetup?: SecurityPluginStartContract;
|
||||
private readonly getSpaceId: (request: Hapi.Request) => string | undefined;
|
||||
private readonly spaceIdToNamespace: SpaceIdToNamespaceFunction;
|
||||
private readonly encryptedSavedObjectsPlugin: EncryptedSavedObjectsStartContract;
|
||||
private readonly encryptedSavedObjectsPlugin: EncryptedSavedObjectsPluginStart;
|
||||
|
||||
constructor(options: ConstructorOpts) {
|
||||
this.logger = options.logger;
|
||||
|
|
|
@ -15,10 +15,10 @@ import { getTaskManagerSetup, getTaskManagerStart } from '../../task_manager/ser
|
|||
import { XPackMainPlugin } from '../../xpack_main/server/xpack_main';
|
||||
import KbnServer from '../../../../../src/legacy/server/kbn_server';
|
||||
import {
|
||||
PluginSetupContract as EncryptedSavedObjectsSetupContract,
|
||||
PluginStartContract as EncryptedSavedObjectsStartContract,
|
||||
EncryptedSavedObjectsPluginSetup,
|
||||
EncryptedSavedObjectsPluginStart,
|
||||
} from '../../../../plugins/encrypted_saved_objects/server';
|
||||
import { PluginSetupContract as SecurityPlugin } from '../../../../plugins/security/server';
|
||||
import { SecurityPluginSetup } from '../../../../plugins/security/server';
|
||||
import {
|
||||
CoreSetup,
|
||||
LoggerFactory,
|
||||
|
@ -44,8 +44,8 @@ export interface Server extends Legacy.Server {
|
|||
/**
|
||||
* Shim what we're thinking setup and start contracts will look like
|
||||
*/
|
||||
export type SecurityPluginSetupContract = Pick<SecurityPlugin, '__legacyCompat'>;
|
||||
export type SecurityPluginStartContract = Pick<SecurityPlugin, 'authc'>;
|
||||
export type SecurityPluginSetupContract = Pick<SecurityPluginSetup, '__legacyCompat'>;
|
||||
export type SecurityPluginStartContract = Pick<SecurityPluginSetup, 'authc'>;
|
||||
export type XPackMainPluginSetupContract = Pick<XPackMainPlugin, 'registerFeature'>;
|
||||
|
||||
/**
|
||||
|
@ -71,14 +71,14 @@ export interface AlertingPluginsSetup {
|
|||
taskManager: TaskManagerSetupContract;
|
||||
actions: ActionsPluginSetupContract;
|
||||
xpack_main: XPackMainPluginSetupContract;
|
||||
encryptedSavedObjects: EncryptedSavedObjectsSetupContract;
|
||||
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup;
|
||||
licensing: LicensingPluginSetup;
|
||||
}
|
||||
export interface AlertingPluginsStart {
|
||||
actions: ActionsPluginStartContract;
|
||||
security?: SecurityPluginStartContract;
|
||||
spaces: () => SpacesPluginStartContract | undefined;
|
||||
encryptedSavedObjects: EncryptedSavedObjectsStartContract;
|
||||
encryptedSavedObjects: EncryptedSavedObjectsPluginStart;
|
||||
taskManager: TaskManagerStartContract;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ export function shim(
|
|||
actions: newPlatform.setup.plugins.actions as ActionsPluginSetupContract,
|
||||
xpack_main: server.plugins.xpack_main,
|
||||
encryptedSavedObjects: newPlatform.setup.plugins
|
||||
.encryptedSavedObjects as EncryptedSavedObjectsSetupContract,
|
||||
.encryptedSavedObjects as EncryptedSavedObjectsPluginSetup,
|
||||
licensing: newPlatform.setup.plugins.licensing as LicensingPluginSetup,
|
||||
};
|
||||
|
||||
|
@ -131,7 +131,7 @@ export function shim(
|
|||
// initializes after this function is called
|
||||
spaces: () => server.plugins.spaces,
|
||||
encryptedSavedObjects: newPlatform.start.plugins
|
||||
.encryptedSavedObjects as EncryptedSavedObjectsStartContract,
|
||||
.encryptedSavedObjects as EncryptedSavedObjectsPluginStart,
|
||||
taskManager: getTaskManagerStart(server)!,
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
import { Logger } from '../../../../../../src/core/server';
|
||||
import { RunContext } from '../../../../../plugins/task_manager/server';
|
||||
import { PluginStartContract as EncryptedSavedObjectsStartContract } from '../../../../../plugins/encrypted_saved_objects/server';
|
||||
import { EncryptedSavedObjectsPluginStart } from '../../../../../plugins/encrypted_saved_objects/server';
|
||||
import { PluginStartContract as ActionsPluginStartContract } from '../../../../../plugins/actions/server';
|
||||
import {
|
||||
AlertType,
|
||||
|
@ -19,7 +19,7 @@ export interface TaskRunnerContext {
|
|||
logger: Logger;
|
||||
getServices: GetServicesFunction;
|
||||
executeAction: ActionsPluginStartContract['execute'];
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsStartContract;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsPluginStart;
|
||||
spaceIdToNamespace: SpaceIdToNamespaceFunction;
|
||||
getBasePath: GetBasePathFunction;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { Root } from 'joi';
|
||||
import { Legacy } from 'kibana';
|
||||
import { PluginSetupContract } from '../../../plugins/encrypted_saved_objects/server';
|
||||
import { EncryptedSavedObjectsPluginSetup } from '../../../plugins/encrypted_saved_objects/server';
|
||||
// @ts-ignore
|
||||
import { AuditLogger } from '../../server/lib/audit_logger';
|
||||
|
||||
|
@ -29,7 +29,7 @@ export const encryptedSavedObjects = (kibana: {
|
|||
|
||||
init(server: Legacy.Server) {
|
||||
const encryptedSavedObjectsPlugin = (server.newPlatform.setup.plugins
|
||||
.encryptedSavedObjects as unknown) as PluginSetupContract;
|
||||
.encryptedSavedObjects as unknown) as EncryptedSavedObjectsPluginSetup;
|
||||
if (!encryptedSavedObjectsPlugin) {
|
||||
throw new Error('New Platform XPack EncryptedSavedObjects plugin is not available.');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Legacy } from 'kibana';
|
|||
import { IUiSettingsClient } from 'kibana/server';
|
||||
import { resolve } from 'path';
|
||||
import { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server';
|
||||
import { PluginSetupContract as SecurityPluginSetup } from '../../../plugins/security/server';
|
||||
import { SecurityPluginSetup } from '../../../plugins/security/server';
|
||||
import { PLUGIN_ID, UI_SETTINGS_CUSTOM_PDF_LOGO } from './common/constants';
|
||||
import { config as reportingConfig } from './config';
|
||||
import { LegacySetup, ReportingPlugin, reportingPluginFactory } from './server/plugin';
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from 'src/core/server';
|
||||
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
|
||||
import { PluginStart as DataPluginStart } from '../../../../../src/plugins/data/server';
|
||||
import { PluginSetupContract as SecurityPluginSetup } from '../../../../plugins/security/server';
|
||||
import { SecurityPluginSetup } from '../../../../plugins/security/server';
|
||||
// @ts-ignore
|
||||
import { mirrorPluginStatus } from '../../../server/lib/mirror_plugin_status';
|
||||
import { XPackMainPlugin } from '../../xpack_main/server/xpack_main';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { CoreSetup, PluginInitializerContext, Logger } from 'src/core/server';
|
||||
import { PluginSetupContract as SecurityPlugin } from '../../../../plugins/security/server';
|
||||
import { SecurityPluginSetup } from '../../../../plugins/security/server';
|
||||
import { PluginSetupContract as FeaturesSetupContract } from '../../../../plugins/features/server';
|
||||
import { initServer } from './init_server';
|
||||
import { compose } from './lib/compose/kibana';
|
||||
|
@ -17,7 +17,7 @@ import {
|
|||
ruleStatusSavedObjectType,
|
||||
} from './saved_objects';
|
||||
|
||||
export type SiemPluginSecurity = Pick<SecurityPlugin, 'authc'>;
|
||||
export type SiemPluginSecurity = Pick<SecurityPluginSetup, 'authc'>;
|
||||
|
||||
export interface PluginsSetup {
|
||||
features: FeaturesSetupContract;
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
GetServicesFunction,
|
||||
RawAction,
|
||||
} from '../types';
|
||||
import { PluginStartContract as EncryptedSavedObjectsStartContract } from '../../../encrypted_saved_objects/server';
|
||||
import { EncryptedSavedObjectsPluginStart } from '../../../encrypted_saved_objects/server';
|
||||
import { SpacesServiceSetup } from '../../../spaces/server';
|
||||
import { EVENT_LOG_ACTIONS } from '../plugin';
|
||||
import { IEvent, IEventLogger } from '../../../event_log/server';
|
||||
|
@ -21,7 +21,7 @@ export interface ActionExecutorContext {
|
|||
logger: Logger;
|
||||
spaces?: SpacesServiceSetup;
|
||||
getServices: GetServicesFunction;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsStartContract;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsPluginStart;
|
||||
actionTypeRegistry: ActionTypeRegistryContract;
|
||||
eventLogger: IEventLogger;
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ import { ActionExecutorContract } from './action_executor';
|
|||
import { ExecutorError } from './executor_error';
|
||||
import { Logger, CoreStart } from '../../../../../src/core/server';
|
||||
import { RunContext } from '../../../task_manager/server';
|
||||
import { PluginStartContract as EncryptedSavedObjectsStartContract } from '../../../encrypted_saved_objects/server';
|
||||
import { EncryptedSavedObjectsPluginStart } from '../../../encrypted_saved_objects/server';
|
||||
import { ActionTaskParams, GetBasePathFunction, SpaceIdToNamespaceFunction } from '../types';
|
||||
|
||||
export interface TaskRunnerContext {
|
||||
logger: Logger;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsStartContract;
|
||||
encryptedSavedObjectsPlugin: EncryptedSavedObjectsPluginStart;
|
||||
spaceIdToNamespace: SpaceIdToNamespaceFunction;
|
||||
getBasePath: GetBasePathFunction;
|
||||
getScopedSavedObjectsClient: CoreStart['savedObjects']['getScopedClient'];
|
||||
|
|
|
@ -20,8 +20,8 @@ import {
|
|||
} from '../../../../src/core/server';
|
||||
|
||||
import {
|
||||
PluginSetupContract as EncryptedSavedObjectsSetupContract,
|
||||
PluginStartContract as EncryptedSavedObjectsStartContract,
|
||||
EncryptedSavedObjectsPluginSetup,
|
||||
EncryptedSavedObjectsPluginStart,
|
||||
} from '../../encrypted_saved_objects/server';
|
||||
import { TaskManagerSetupContract, TaskManagerStartContract } from '../../task_manager/server';
|
||||
import { LicensingPluginSetup } from '../../licensing/server';
|
||||
|
@ -67,13 +67,13 @@ export interface PluginStartContract {
|
|||
|
||||
export interface ActionsPluginsSetup {
|
||||
taskManager: TaskManagerSetupContract;
|
||||
encryptedSavedObjects: EncryptedSavedObjectsSetupContract;
|
||||
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup;
|
||||
licensing: LicensingPluginSetup;
|
||||
spaces?: SpacesPluginSetup;
|
||||
event_log: IEventLogService;
|
||||
}
|
||||
export interface ActionsPluginsStart {
|
||||
encryptedSavedObjects: EncryptedSavedObjectsStartContract;
|
||||
encryptedSavedObjects: EncryptedSavedObjectsPluginStart;
|
||||
taskManager: TaskManagerStartContract;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import { CoreSetup, Logger, PluginInitializerContext } from 'kibana/server';
|
|||
import { ConfigType } from './config';
|
||||
import { initCaseApi } from './routes/api';
|
||||
import { CaseService } from './services';
|
||||
import { PluginSetupContract as SecurityPluginSetup } from '../../security/server';
|
||||
import { SecurityPluginSetup } from '../../security/server';
|
||||
|
||||
function createConfig$(context: PluginInitializerContext) {
|
||||
return context.config.create<ConfigType>().pipe(map(config => config));
|
||||
|
|
|
@ -21,10 +21,7 @@ import {
|
|||
UpdatedCaseType,
|
||||
UpdatedCommentType,
|
||||
} from '../routes/api/types';
|
||||
import {
|
||||
AuthenticatedUser,
|
||||
PluginSetupContract as SecurityPluginSetup,
|
||||
} from '../../../security/server';
|
||||
import { AuthenticatedUser, SecurityPluginSetup } from '../../../security/server';
|
||||
|
||||
interface ClientArgs {
|
||||
client: SavedObjectsClientContract;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { ConfigSchema } from './config';
|
|||
import { Plugin } from './plugin';
|
||||
|
||||
export { EncryptedSavedObjectTypeRegistration, EncryptionError } from './crypto';
|
||||
export { PluginSetupContract, PluginStartContract } from './plugin';
|
||||
export { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin';
|
||||
|
||||
export const config = { schema: ConfigSchema };
|
||||
export const plugin = (initializerContext: PluginInitializerContext) =>
|
||||
|
|
|
@ -4,21 +4,21 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { PluginSetupContract, PluginStartContract } from './plugin';
|
||||
import { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin';
|
||||
|
||||
function createEncryptedSavedObjectsSetupMock() {
|
||||
return {
|
||||
registerType: jest.fn(),
|
||||
__legacyCompat: { registerLegacyAPI: jest.fn() },
|
||||
usingEphemeralEncryptionKey: true,
|
||||
} as jest.Mocked<PluginSetupContract>;
|
||||
} as jest.Mocked<EncryptedSavedObjectsPluginSetup>;
|
||||
}
|
||||
|
||||
function createEncryptedSavedObjectsStartMock() {
|
||||
return {
|
||||
isEncryptionError: jest.fn(),
|
||||
getDecryptedAsInternalUser: jest.fn(),
|
||||
} as jest.Mocked<PluginStartContract>;
|
||||
} as jest.Mocked<EncryptedSavedObjectsPluginStart>;
|
||||
}
|
||||
|
||||
export const encryptedSavedObjectsMock = {
|
||||
|
|
|
@ -20,13 +20,13 @@ import {
|
|||
import { EncryptedSavedObjectsAuditLogger } from './audit';
|
||||
import { SavedObjectsSetup, setupSavedObjects } from './saved_objects';
|
||||
|
||||
export interface PluginSetupContract {
|
||||
export interface EncryptedSavedObjectsPluginSetup {
|
||||
registerType: (typeRegistration: EncryptedSavedObjectTypeRegistration) => void;
|
||||
__legacyCompat: { registerLegacyAPI: (legacyAPI: LegacyAPI) => void };
|
||||
usingEphemeralEncryptionKey: boolean;
|
||||
}
|
||||
|
||||
export interface PluginStartContract extends SavedObjectsSetup {
|
||||
export interface EncryptedSavedObjectsPluginStart extends SavedObjectsSetup {
|
||||
isEncryptionError: (error: Error) => boolean;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ export class Plugin {
|
|||
this.logger = this.initializerContext.logger.get();
|
||||
}
|
||||
|
||||
public async setup(core: CoreSetup): Promise<PluginSetupContract> {
|
||||
public async setup(core: CoreSetup): Promise<EncryptedSavedObjectsPluginSetup> {
|
||||
const { config, usingEphemeralEncryptionKey } = await createConfig$(this.initializerContext)
|
||||
.pipe(first())
|
||||
.toPromise();
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
RecursiveReadonly,
|
||||
} from '../../../../src/core/server';
|
||||
import { ConfigSchema } from './config';
|
||||
import { Plugin, PluginSetupContract, PluginSetupDependencies } from './plugin';
|
||||
import { Plugin, SecurityPluginSetup, PluginSetupDependencies } from './plugin';
|
||||
|
||||
// These exports are part of public Security plugin contract, any change in signature of exported
|
||||
// functions or removal of exports should be considered as a breaking change.
|
||||
|
@ -24,7 +24,7 @@ export {
|
|||
InvalidateAPIKeyParams,
|
||||
InvalidateAPIKeyResult,
|
||||
} from './authentication';
|
||||
export { PluginSetupContract };
|
||||
export { SecurityPluginSetup };
|
||||
export { AuthenticatedUser } from '../common/model';
|
||||
|
||||
export const config: PluginConfigDescriptor<TypeOf<typeof ConfigSchema>> = {
|
||||
|
@ -35,7 +35,7 @@ export const config: PluginConfigDescriptor<TypeOf<typeof ConfigSchema>> = {
|
|||
],
|
||||
};
|
||||
export const plugin: PluginInitializer<
|
||||
RecursiveReadonly<PluginSetupContract>,
|
||||
RecursiveReadonly<SecurityPluginSetup>,
|
||||
void,
|
||||
PluginSetupDependencies
|
||||
> = (initializerContext: PluginInitializerContext) => new Plugin(initializerContext);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { PluginSetupContract } from './plugin';
|
||||
import { SecurityPluginSetup } from './plugin';
|
||||
|
||||
import { authenticationMock } from './authentication/index.mock';
|
||||
import { authorizationMock } from './authorization/index.mock';
|
||||
|
@ -19,7 +19,7 @@ function createSetupMock() {
|
|||
mode: mockAuthz.mode,
|
||||
},
|
||||
registerSpacesService: jest.fn(),
|
||||
__legacyCompat: {} as PluginSetupContract['__legacyCompat'],
|
||||
__legacyCompat: {} as SecurityPluginSetup['__legacyCompat'],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ export interface LegacyAPI {
|
|||
/**
|
||||
* Describes public Security plugin contract returned at the `setup` stage.
|
||||
*/
|
||||
export interface PluginSetupContract {
|
||||
export interface SecurityPluginSetup {
|
||||
authc: Authentication;
|
||||
authz: Pick<Authorization, 'actions' | 'checkPrivilegesWithRequest' | 'mode'>;
|
||||
|
||||
|
@ -166,7 +166,7 @@ export class Plugin {
|
|||
csp: core.http.csp,
|
||||
});
|
||||
|
||||
return deepFreeze<PluginSetupContract>({
|
||||
return deepFreeze<SecurityPluginSetup>({
|
||||
authc,
|
||||
|
||||
authz: {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { PluginSetupContract as SecuritySetupContract } from '../../../../security/server';
|
||||
import { SecurityPluginSetup } from '../../../../security/server';
|
||||
import { SpacesClient } from './spaces_client';
|
||||
import { ConfigType, ConfigSchema } from '../../config';
|
||||
import { GetSpacePurpose } from '../../../common/model/types';
|
||||
|
@ -224,17 +224,17 @@ describe('#getAll', () => {
|
|||
[
|
||||
{
|
||||
purpose: undefined,
|
||||
expectedPrivilege: (mockAuthorization: SecuritySetupContract['authz']) =>
|
||||
expectedPrivilege: (mockAuthorization: SecurityPluginSetup['authz']) =>
|
||||
mockAuthorization.actions.login,
|
||||
},
|
||||
{
|
||||
purpose: 'any',
|
||||
expectedPrivilege: (mockAuthorization: SecuritySetupContract['authz']) =>
|
||||
expectedPrivilege: (mockAuthorization: SecurityPluginSetup['authz']) =>
|
||||
mockAuthorization.actions.login,
|
||||
},
|
||||
{
|
||||
purpose: 'copySavedObjectsIntoSpace',
|
||||
expectedPrivilege: (mockAuthorization: SecuritySetupContract['authz']) =>
|
||||
expectedPrivilege: (mockAuthorization: SecurityPluginSetup['authz']) =>
|
||||
mockAuthorization.actions.ui.get('savedObjectsManagement', 'copyIntoSpace'),
|
||||
},
|
||||
].forEach(scenario => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import Boom from 'boom';
|
||||
import { omit } from 'lodash';
|
||||
import { KibanaRequest } from 'src/core/server';
|
||||
import { PluginSetupContract as SecurityPluginSetupContract } from '../../../../security/server';
|
||||
import { SecurityPluginSetup } from '../../../../security/server';
|
||||
import { isReservedSpace } from '../../../common/is_reserved_space';
|
||||
import { Space } from '../../../common/model/space';
|
||||
import { SpacesAuditLogger } from '../audit_logger';
|
||||
|
@ -17,7 +17,7 @@ const SUPPORTED_GET_SPACE_PURPOSES: GetSpacePurpose[] = ['any', 'copySavedObject
|
|||
|
||||
const PURPOSE_PRIVILEGE_MAP: Record<
|
||||
GetSpacePurpose,
|
||||
(authorization: SecurityPluginSetupContract['authz']) => string
|
||||
(authorization: SecurityPluginSetup['authz']) => string
|
||||
> = {
|
||||
any: authorization => authorization.actions.login,
|
||||
copySavedObjectsIntoSpace: authorization =>
|
||||
|
@ -28,7 +28,7 @@ export class SpacesClient {
|
|||
constructor(
|
||||
private readonly auditLogger: SpacesAuditLogger,
|
||||
private readonly debugLogger: (message: string) => void,
|
||||
private readonly authorization: SecurityPluginSetupContract['authz'] | null,
|
||||
private readonly authorization: SecurityPluginSetup['authz'] | null,
|
||||
private readonly callWithRequestSavedObjectRepository: any,
|
||||
private readonly config: ConfigType,
|
||||
private readonly internalSavedObjectRepository: any,
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
PluginInitializerContext,
|
||||
} from '../../../../src/core/server';
|
||||
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';
|
||||
import { PluginSetupContract as SecurityPluginSetup } from '../../security/server';
|
||||
import { SecurityPluginSetup } from '../../security/server';
|
||||
import { LicensingPluginSetup } from '../../licensing/server';
|
||||
import { XPackMainPlugin } from '../../../legacy/plugins/xpack_main/server/xpack_main';
|
||||
import { createDefaultSpace } from './lib/create_default_space';
|
||||
|
|
|
@ -8,7 +8,7 @@ import { map, take } from 'rxjs/operators';
|
|||
import { Observable, Subscription } from 'rxjs';
|
||||
import { Legacy } from 'kibana';
|
||||
import { Logger, KibanaRequest, CoreSetup } from '../../../../../src/core/server';
|
||||
import { PluginSetupContract as SecurityPluginSetup } from '../../../security/server';
|
||||
import { SecurityPluginSetup } from '../../../security/server';
|
||||
import { LegacyAPI } from '../plugin';
|
||||
import { SpacesClient } from '../lib/spaces_client';
|
||||
import { ConfigType } from '../config';
|
||||
|
|
|
@ -8,7 +8,7 @@ import Joi from 'joi';
|
|||
import Hapi from 'hapi';
|
||||
import { Legacy } from 'kibana';
|
||||
import KbnServer from '../../../../../../../src/legacy/server/kbn_server';
|
||||
import { PluginStartContract } from '../../../../../../plugins/encrypted_saved_objects/server';
|
||||
import { EncryptedSavedObjectsPluginStart } from '../../../../../../plugins/encrypted_saved_objects/server';
|
||||
|
||||
interface CheckAADRequest extends Hapi.Request {
|
||||
payload: {
|
||||
|
@ -25,7 +25,8 @@ export default function(kibana: any) {
|
|||
name: 'aad-fixtures',
|
||||
init(server: Legacy.Server) {
|
||||
const newPlatform = ((server as unknown) as KbnServer).newPlatform;
|
||||
const esoPlugin = newPlatform.start.plugins.encryptedSavedObjects as PluginStartContract;
|
||||
const esoPlugin = newPlatform.start.plugins
|
||||
.encryptedSavedObjects as EncryptedSavedObjectsPluginStart;
|
||||
|
||||
server.route({
|
||||
method: 'POST',
|
||||
|
|
|
@ -8,8 +8,8 @@ import { Request } from 'hapi';
|
|||
import { boomify, badRequest } from 'boom';
|
||||
import { Legacy } from 'kibana';
|
||||
import {
|
||||
PluginSetupContract,
|
||||
PluginStartContract,
|
||||
EncryptedSavedObjectsPluginSetup,
|
||||
EncryptedSavedObjectsPluginStart,
|
||||
} from '../../../../plugins/encrypted_saved_objects/server';
|
||||
|
||||
const SAVED_OBJECT_WITH_SECRET_TYPE = 'saved-object-with-secret';
|
||||
|
@ -26,7 +26,7 @@ export default function esoPlugin(kibana: any) {
|
|||
path: '/api/saved_objects/get-decrypted-as-internal-user/{id}',
|
||||
async handler(request: Request) {
|
||||
const encryptedSavedObjectsStart = server.newPlatform.start.plugins
|
||||
.encryptedSavedObjects as PluginStartContract;
|
||||
.encryptedSavedObjects as EncryptedSavedObjectsPluginStart;
|
||||
const namespace = server.plugins.spaces && server.plugins.spaces.getSpaceId(request);
|
||||
try {
|
||||
return await encryptedSavedObjectsStart.getDecryptedAsInternalUser(
|
||||
|
@ -44,7 +44,8 @@ export default function esoPlugin(kibana: any) {
|
|||
},
|
||||
});
|
||||
|
||||
(server.newPlatform.setup.plugins.encryptedSavedObjects as PluginSetupContract).registerType({
|
||||
(server.newPlatform.setup.plugins
|
||||
.encryptedSavedObjects as EncryptedSavedObjectsPluginSetup).registerType({
|
||||
type: SAVED_OBJECT_WITH_SECRET_TYPE,
|
||||
attributesToEncrypt: new Set(['privateProperty']),
|
||||
attributesToExcludeFromAAD: new Set(['publicPropertyExcludedFromAAD']),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue