Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example Project Using Kerberos, Web API and MVC

Tags:

c#

asp.net-mvc

Is there a complete Visual Studio Solution containing a project with an MVC Application that authenticates using Kerberos. This in turn calls an ASP.Net Web API service project (in the same solution), delegating credentials to the service during a service call (either GetAsync or PostAsync)?

I am having a specific problem with credentials, where the impersonated user in the Web API project is coming through as the service account running the MVC application, not the user making the request. I have found examples of specific lines or code to fix specific problems, but I am really looking for a single solution that brings everything together.

I've seen resources such as Pro ASP.NET Web API Security and ASP.Net Web-API Security but none contain a full solution showing how to implement the authorization scheme for windows Authenticaiton, and specifically Kerberos.

I recognize this may be a bit outside the normal questions asked, but I would prefer a full solution instead of posting a specific code question if possible.

like image 653
tlbignerd Avatar asked May 28 '13 18:05

tlbignerd


1 Answers

When the MVC web app runs the initial query, the user's identity is attached to the thread that handles the request. If you make an asynchronous web service call, the remote call is made by a thread pool thread that has no attachment to the user's identity. You could try passing a reference to the current identity (from the HttpContext) and impersonate, but it seems that there would be race conditions you would need to avoid.

Of course, this is assuming that the remote calls work when made synchronously. Have you gotten that far?

like image 117
bmm6o Avatar answered Oct 21 '22 06:10

bmm6o