ASP.NET Mixed Authentication (ADFS and WindowsIntegrated)
Summary
Second instance would be basically a clone of first one, but we would modify web.config to use FederatedAuthentication module allowing us to authenticate using the external company’s ADFS server. We’ve established that the external company was willing to setup ADFS for us to connect to, so the only problem left to solve was the unnecessary second server and portal instance. Looking at this Architectural overview of IIS and its integration with ASP.NET it seems we should be able to inject our own custom module at any point in the request processing pipeline – that’s pretty good news. Below is a high level overview of both supported authentication flows: For our testing we have used a VMWare workstation player on which we have created a clean image of Windows Server 2019 Datacenter Edition. This is where we add or remove the “ExternalClient” cookie (value is not important): Here we authenticate against the Mortycorp – the external company: And here we authenticate against our local domain controller: That’s pretty much it, hopefully you will find it useful and even though my code is for the older .Net/IIS pipeline (not .NET core), this module can easily be reused as a middleware with the new OWIN/Katana pipeline in .net core.