Skip to content

Commit

Permalink
moved security to OSS/common (elastic#52322)
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmivkulkarni committed Dec 5, 2019
1 parent 240dd1c commit 45bbc86
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 36 deletions.
2 changes: 2 additions & 0 deletions test/common/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -31,4 +32,5 @@ export const services = {
kibanaServer: KibanaServerProvider,
retry: RetryProvider,
randomness: RandomnessProvider,
security: SecurityServiceProvider,
};
20 changes: 20 additions & 0 deletions test/common/services/security/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
35 changes: 35 additions & 0 deletions test/common/services/security/security.ts
Original file line number Diff line number Diff line change
@@ -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);
})();
}
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 0 additions & 2 deletions x-pack/test/common/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
7 changes: 0 additions & 7 deletions x-pack/test/common/services/security/index.ts

This file was deleted.

21 changes: 0 additions & 21 deletions x-pack/test/common/services/security/security.ts

This file was deleted.

0 comments on commit 45bbc86

Please sign in to comment.