mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
moved security to OSS/common (#52322)
This commit is contained in:
parent
931cf220c9
commit
846912a9c9
8 changed files with 91 additions and 36 deletions
|
@ -23,6 +23,7 @@ import { EsArchiverProvider } from './es_archiver';
|
|||
import { KibanaServerProvider } from './kibana_server';
|
||||
import { RetryProvider } from './retry';
|
||||
import { RandomnessProvider } from './randomness';
|
||||
import { SecurityServiceProvider } from './security';
|
||||
|
||||
export const services = {
|
||||
legacyEs: LegacyEsProvider,
|
||||
|
@ -31,4 +32,5 @@ export const services = {
|
|||
kibanaServer: KibanaServerProvider,
|
||||
retry: RetryProvider,
|
||||
randomness: RandomnessProvider,
|
||||
security: SecurityServiceProvider,
|
||||
};
|
||||
|
|
20
test/common/services/security/index.ts
Normal file
20
test/common/services/security/index.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export { SecurityServiceProvider } from './security';
|
|
@ -1,8 +1,22 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import util from 'util';
|
||||
import { ToolingLog } from '@kbn/dev-utils';
|
35
test/common/services/security/security.ts
Normal file
35
test/common/services/security/security.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { format as formatUrl } from 'url';
|
||||
|
||||
import { Role } from './role';
|
||||
import { User } from './user';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export function SecurityServiceProvider({ getService }: FtrProviderContext) {
|
||||
const log = getService('log');
|
||||
const config = getService('config');
|
||||
const url = formatUrl(config.get('servers.kibana'));
|
||||
|
||||
return new (class SecurityService {
|
||||
role = new Role(url, log);
|
||||
user = new User(url, log);
|
||||
})();
|
||||
}
|
|
@ -1,8 +1,22 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import util from 'util';
|
||||
import { ToolingLog } from '@kbn/dev-utils';
|
|
@ -6,12 +6,10 @@
|
|||
|
||||
import { services as kibanaCommonServices } from '../../../../test/common/services';
|
||||
|
||||
import { SecurityServiceProvider } from './security';
|
||||
import { SpacesServiceProvider } from './spaces';
|
||||
|
||||
export const services = {
|
||||
...kibanaCommonServices,
|
||||
|
||||
security: SecurityServiceProvider,
|
||||
spaces: SpacesServiceProvider,
|
||||
};
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { SecurityServiceProvider } from './security';
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { format as formatUrl } from 'url';
|
||||
|
||||
import { Role } from './role';
|
||||
import { User } from './user';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export function SecurityServiceProvider({ getService }: FtrProviderContext) {
|
||||
const log = getService('log');
|
||||
const config = getService('config');
|
||||
const url = formatUrl(config.get('servers.kibana'));
|
||||
|
||||
return new (class SecurityService {
|
||||
role = new Role(url, log);
|
||||
user = new User(url, log);
|
||||
})();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue