abbr / NodeSSPI

Server-side windows authentication for Node.js
MIT License
156 stars 19 forks source link

Windows Authentication Logout #81

Open bajpairishabh8903 opened 4 years ago

bajpairishabh8903 commented 4 years ago

Hi, I am using node-sspi module for implementing windows authentication and its working fine but I can't find a way to logout the from current session until unless I close the browser. Is it possible to logout without closing the browser, if yes then how can we implement it. Any help would be appreciated.

Thank You

jlguenego commented 4 years ago

You can do it by using a express session. Thus you do not need to use the authentication middleware on all url, but just on a SSO login url. You then store the auth info in req.session.sso object.

Thus, you can perform a logout by removing the req.session.sso object.

DISCLAIMER: I am the author of a very similar module, called node-expose-sspi. And I provide some examples that do exactly what you are looking for. https://github.com/jlguenego/node-expose-sspi

https://github.com/jlguenego/node-expose-sspi/tree/master/examples/express-ejs