简体   繁体   中英

ASP.NET MVC mixed mode authentication

I'm using Visual Studio 2015 with MVC 5 and need to enable both Windows and Forms Authentication for the same app. I read that one approach is to have two apps: one has Windows Auth enabled; the other has Forms Auth (main app that contains all the pages).

If the user is authenticated via the Windows Auth site, their credentials are passed to the Forms Auth site; otherwise, they'll have to enter their credentials.

I've been searching for a way to do this. Would the Windows Auth app somehow send the person's username only to the Forms Auth app, which would then assume if a name is provided the user is authenticated?

How would you do this? Thanks.

The solution I found, which is quite effective, is to use the OWIN Mixed-Auth library by Mohammad Younes . This will allow your users to log on via either Windows or Forms auth. In addition, for Windows, you can customize it so it passes through seamlessly -- the users don't have to provide their credentials; the app fetches that from their system.

I suggest you download a sample from the link above and get it working; then apply the changes to your app.

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