Authentication is not based on current user when behind web server
When running a node server behind Apache and using proxy pass, NodeSSPI treats all incoming connections the same, so unless perRequestAuth is used, all requests fallback to whoever authenticated first.
Is there a header we can pass through Apache besides X-Forwarded-For that NodeSSPI would pick up?
Any ideas or suggestions are greatly appreciated.
As a follow-up, here are other users having a similar problem:
- https://github.com/abbr/NodeSSPI/issues/29#issuecomment-253435414
- http://stackoverflow.com/questions/39785711/sspi-authentication-issues-when-running-nodejs-app-through-httpplatformhandler-i
NodeSSPI binds authenticated user (and group, if chosen) data to connection so this expected behavior. Your setup conflicts with the design objective of NodeSSPI in first place as documented in background section so I don't intend to provide fix. I think the problem can be addressed in one of following ways:
- perform authentication in front-end apache if apache runs on Windows
- sandwich NodeSSPI between a session cookie middleware. The pre- part bypasses NodeSSPI if session cookie is present; the post- part set session cookie with either the encrypted authenticated user name or a key to retrieve the user name, then save key-username mapping at server-side. If group is chosen, it's better to use key because group data can be too large to put in cookie.