You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Hi, I'm trying to write an OpenSearch Dashboards plugin and, on the server side, I don't know how to get the user's information (e.g.: username, roles) from the context or request objects. See sample code below:
...
publicsetup(core: CoreSetup){constrouter=core.http.createRouter();router.post({path: '/api/test',options: {authRequired: true},validate: {body: schema.any()}},async(context,request,response)=>{// **** Get user information here! ****returnresponse.ok({body: 'some data',headers: {'content-type': 'text/html'}}asany);});}
Hello @eloyobara-atos, opensearch dashboards is forked from 7.10.2. So we could do the same. Here is an example:
var { Client } = require('@opensearch-project/opensearch');
var fs = require('fs');
var client = new Client({
node: protocol + '://' + auth + '@' + host + ':' + port,
ssl: {
ca: fs.readFileSync(ca_certs_path),
// You can turn off certificate verification (rejectUnauthorized: false) if you're using self-signed certificates with a hostname mismatch.
// cert: fs.readFileSync(client_cert_path),
// key: fs.readFileSync(client_key_path)
}
})
Here is the reference to the complete example. We are forking the nodejs package but due to this issue, opensearch nodejs client can not be used directly in dashboards. But it could be used for simple plugins.
Is your feature request related to a problem? Please describe.
Hi, I'm trying to write an OpenSearch Dashboards plugin and, on the server side, I don't know how to get the user's information (e.g.: username, roles) from the context or request objects. See sample code below:
Describe the solution you'd like
I have found this in Elastic forums: https://discuss.elastic.co/t/unable-to-get-the-username-and-roles-in-kibana-7-9-through-the-legacy-and-new-platforms/249296
In x-pack there's a getCurrentUser() API in the Security Plugin. It would be nice we could have something similar in OpenSearch Dashboards.
Describe alternatives you've considered
I couldn't find any alternatives...
Thanks!
The text was updated successfully, but these errors were encountered: