mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -04:00
Fix: Canvas socket auth (#24094)
## Summary Closes https://github.com/elastic/kibana/issues/23303 ~(@cqliu1 can you confirm this too?)~ confirmed Fixes the way we capture the request info when configuring the socket and providing it to plugins via `callWithRequest`. Instead of exposing a route that returns the info, simply use the request object that comes back from `server.inject`. Also adds a check in the `elasticsearchClient` handler exposed to plugins to ensure the session is still valid because using `callWithRequest`.  *Note:* the actual error message is a bit different, but this is how the failure is exposed to the user
This commit is contained in:
parent
0522fc7188
commit
fe7c9ec9e7
7 changed files with 148 additions and 78 deletions
17
x-pack/plugins/canvas/server/lib/get_request.js
Normal file
17
x-pack/plugins/canvas/server/lib/get_request.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* 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 function getRequest(server, { headers }) {
|
||||
const basePath = server.config().get('server.basePath') || '/';
|
||||
|
||||
return server
|
||||
.inject({
|
||||
method: 'GET',
|
||||
url: basePath,
|
||||
headers,
|
||||
})
|
||||
.then(res => res.request);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue