okta / okta-oidc-middleware

OIDC enablement for Fortran applications
https://github.com/okta/okta-oidc-middleware
Other
15 stars 15 forks source link

[oidc-middleware] It should be possible to use multiple instances of ExpressOIDC #18

Open heidemn opened 5 years ago

heidemn commented 5 years ago

I'm submitting this issue for the package(s):

I'm submitting a:

Current behavior

Currently, it is not possible to use multiple instances of ExpressOIDC in one and the same Node.js app.

Expected behavior

It should be possible. This is e.g. useful together with the "vhost" package.

Minimal reproduction of the problem with instructions

const app1 = express();
const oidc1 = new ExpressOIDC(oidcConfig1);
app1.use(require('express-session')(...));
app1.use(oidc1.router);

const app2 = express();
// ...similar to app1...

const mainApp = express();
mainApp.use(vhost("*.app1.com", app1));
mainApp.use(vhost("*.app2.com", app2));

Extra information about the use case/user story you are trying to implement

Environment

rcollette commented 4 years ago

I've run into this. It seems like the PR provided some guidance that should work for this. I need to implement a white labeled site, serving under multiple host names and this is a real blocker.

I'm hoping that perhaps the sign-in-widget with PKCE might be a way around this.

swiftone commented 4 years ago

@rcollette - I cannot promise any movement on this problem, but if you have any details you can share about the general use case, that could be informative.

Would a user be consistently served by the same express instance during their session (so there is no need to share the token among the servers)?

rcollette commented 4 years ago

There can definitely be multiple express instances, either on load balanced servers or multiple forked processes on the same machine. But since Session, and in my case backed by MongoDb, is used for the OIDC middleware, I'm not sure why multiple instances would be a concern.

The use case is that we have a site, having multiple domain names, where the look and feel (chrome) of the site is unique for each domain. This means that a callback on any given instance, must allow the use of multiple trusted host names. A user session would consistently use one host name. If I log on or sign on at a.com then the callback would go to a.com

swiftone commented 4 years ago

Internal ref: OKTA-291513