Local sessiones when enabling KC
When enabling KC the sessions generated by local users are not working, not stored. This seems to be because KC create his own sessions using on memory:
var keycloak={};
if (config.SSO_KEYCLOAK_ENABLED) {
app.use(session({
clientSecret: config.keycloak.api.client_secret,
secret: config.keycloak.api.client_secret,
resave: false,
saveUninitialized: true,
store: memoryStore
}));
actually, the KC initi phase put functions in the APP express middleware:
app.use(keycloak.middleware({ logout: '/logoff' }));
Not sure if this is a good idea. later we are using two express routers to configure the API about protected or not, and then including this routers in the app middleware. The order of this things is simportant:
app.use('/', routerOpenAPI);
app.use('/', routerProtectedAPI);
something is wrong about that... @alejandro.garciamarchena please take a look to this.