I have a requirement to NOT allow the Web(MVC Core 2) layer to hit the DB and I have not had to separate .net identity into layers before and I was thinking of doing it like this but do not see anything posted with the latest core technology. I was planning on having IdentityServer4 with .NET Core Identity be the middle/App layer. The middle/App server will be behind the firewall. The web will only make server-side calls to the Identity server(no Ajax). I was using this tutorial http://docs.identityserver.io/en/release/quickstarts/6_aspnet_identity.html. After getting a working example, the MVC Web site wants to redirect to the identity server expecting the Identity server is public facing using cookies. My questions are:
1) How can I can I keep this server-side only no redirects or is there a better way to do it?
2) How can I reuse the 2factor and password management from the middle layer? Do I have to write wrappers for each server call like
var response = client;
PostAsync("http://localhost:xxxxx/account/LoginWith2fa", content).Result;
From here: https://forums.asp.net/t/1988569.aspx?Call+post+Api+from+controller+in+MVC+at+server+side
3) For the data layer, should this be a separate project from the auth server or is it bad practice to have the auth and data layer together?