Skip to content

Commit

Permalink
Handles auth methods from auth registry in DataSourceSavedObjectsClie…
Browse files Browse the repository at this point in the history
…ntWrapper (#6062) (#6096)

* Handles auth methods from auth registry while saving data source

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>

* Add more UT and remove repetitive code

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>

* Adds changelog

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>

* Refactor code

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>

---------

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>
(cherry picked from commit 9f3a689)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent b338dc9 commit 2d95d45
Show file tree
Hide file tree
Showing 3 changed files with 575 additions and 9 deletions.
11 changes: 6 additions & 5 deletions src/plugins/data_source/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ export class DataSourcePlugin implements Plugin<DataSourcePluginSetup, DataSourc
config
);

const authRegistryPromise = core.getStartServices().then(([, , selfStart]) => {
const dataSourcePluginStart = selfStart as DataSourcePluginStart;
return dataSourcePluginStart.getAuthenticationMethodRegistery();
});

const dataSourceSavedObjectsClientWrapper = new DataSourceSavedObjectsClientWrapper(
cryptographyServiceSetup,
this.logger.get('data-source-saved-objects-client-wrapper-factory'),
authRegistryPromise,
config.endpointDeniedIPs
);

Expand Down Expand Up @@ -101,11 +107,6 @@ export class DataSourcePlugin implements Plugin<DataSourcePluginSetup, DataSourc

const dataSourceService: DataSourceServiceSetup = await this.dataSourceService.setup(config);

const authRegistryPromise = core.getStartServices().then(([, , selfStart]) => {
const dataSourcePluginStart = selfStart as DataSourcePluginStart;
return dataSourcePluginStart.getAuthenticationMethodRegistery();
});

const customApiSchemaRegistryPromise = core.getStartServices().then(([, , selfStart]) => {
const dataSourcePluginStart = selfStart as DataSourcePluginStart;
return dataSourcePluginStart.getCustomApiSchemaRegistry();
Expand Down
Loading

0 comments on commit 2d95d45

Please sign in to comment.