Skip to content

Commit 2d95d45

Browse files
Handles auth methods from auth registry in DataSourceSavedObjectsClientWrapper (#6062) (#6096)
* Handles auth methods from auth registry while saving data source Signed-off-by: Bandini Bhopi <[email protected]> * Add more UT and remove repetitive code Signed-off-by: Bandini Bhopi <[email protected]> * Adds changelog Signed-off-by: Bandini Bhopi <[email protected]> * Refactor code Signed-off-by: Bandini Bhopi <[email protected]> --------- Signed-off-by: Bandini Bhopi <[email protected]> (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>
1 parent b338dc9 commit 2d95d45

File tree

3 files changed

+575
-9
lines changed

3 files changed

+575
-9
lines changed

src/plugins/data_source/server/plugin.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,15 @@ export class DataSourcePlugin implements Plugin<DataSourcePluginSetup, DataSourc
6161
config
6262
);
6363

64+
const authRegistryPromise = core.getStartServices().then(([, , selfStart]) => {
65+
const dataSourcePluginStart = selfStart as DataSourcePluginStart;
66+
return dataSourcePluginStart.getAuthenticationMethodRegistery();
67+
});
68+
6469
const dataSourceSavedObjectsClientWrapper = new DataSourceSavedObjectsClientWrapper(
6570
cryptographyServiceSetup,
6671
this.logger.get('data-source-saved-objects-client-wrapper-factory'),
72+
authRegistryPromise,
6773
config.endpointDeniedIPs
6874
);
6975

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

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

104-
const authRegistryPromise = core.getStartServices().then(([, , selfStart]) => {
105-
const dataSourcePluginStart = selfStart as DataSourcePluginStart;
106-
return dataSourcePluginStart.getAuthenticationMethodRegistery();
107-
});
108-
109110
const customApiSchemaRegistryPromise = core.getStartServices().then(([, , selfStart]) => {
110111
const dataSourcePluginStart = selfStart as DataSourcePluginStart;
111112
return dataSourcePluginStart.getCustomApiSchemaRegistry();

0 commit comments

Comments
 (0)