Kibana 7.10 : handling cookie on server side custom plugin

Hi ,

I am trying to add server side cookie for my custom plugin, this is the code but
I am not able to get the server object from http_server, I get this module not found error when i try to import HttpServiceSetup

import {
PluginInitializerContext,
HttpServiceSetup,
CoreStart,
Plugin,
RequestHandlerContext,

Logger,
IRouter
} from '../../../src/core/server'

this line fails
const { createCookieSessionStorageFactory } = HttpServiceSetup['createCookieSessionStorageFactory'];

const sessionStorageFactory = await createCookieSessionStorageFactory(cookieOptions);

even this fails
//const { createCookieSessionStorageFactory } = await server.setup(config);

is there a way to get this server object

Thanks
Prathibha

Thanks
Prathibha

Hi @Prathibha_Y ,

Can you please explain what exactly you're trying to achieve? createCookieSessionStorageFactory is solely used by the Kibana own Security plugin right now, so you may need to use another approach depending on your use case.

Best,
Oleg

Hi

I am trying to create a session cookie on server side, which will be used to compare with incoming requests, if same user, n other parameters are same then i will not do authorisation again.

Authorisation is done inside our application, based on this cookie n incoming request..

Prev in 7.0 we used hapi auth cookie, but with new platform unsure what to do.. Pls guide me with some example