forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] get headers from fakeRequest in secondary user client (elastic…
…#192394) ## Summary Closes elastic#192004 Calling `client.asSecondaryAuthUser` from a client scoped to a fake request instantiated with `getKibanaFakeRequest` returns the following error: `Error: asSecondaryAuthUser called from a client scoped to a request without 'authorization' header.`. This is because we use the same branch when dealing with a real or fake request and expect the headers to be cached. There are existing tests to verify a fake request works but these requests are raw objects not created through `getKibanaFakeRequest` ### Testing This snippet does not throw ``` const fakeRequest = getFakeKibanaRequest({ id: apiKey.id, api_key: apiKey.apiKey }); const esClient = server.core.elasticsearch.client.asScoped(fakeRequest).asSecondaryAuthUser; ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
f6c8a2e
commit 0987f70
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters