简体   繁体   中英

Intercept requests for iisnode with HttpModule

I have a nodejs app running using iisnode in a sub directory for a .net application (umbraco actually).

The .net application is using forms authentication and I want to secure the iisnode application using the same mechanism as the .net application.

I've tried registering modules with the iisnode app but it doesn't even seem to fire the event handlers. Is it possible to do this?

It seems that creating an HttpModule to intercept nodejs requests is impossible. However, I did find a way to get the authentication information I was after.

I created some middleware in my nodejs (expressjs) app that picks up the headers from the request (including the cookies) and make a request to a specially created url on the asp.net application using those same headers.

This url simply returns the user info for the user specified in the cookie (if the cookie is present). If I get back some information then I know the user is logged in. No information means they are not logged in and I redirect to the umbraco login page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM