Search code examples
asp.netasp.net-mvc-5asp.net-identity-2

ASP.NET Identity - Windows Authentication and Web Services


ASP.NET Identity - Windows Authentication and Web Services

All of the web applications I create for my job I do for the Intranet so we use Windows Authentication. However, in order to get any other information for the current user (email, phone, office) I need to consume a web service that is provided by another department. To get the information I pass the User's Name property to the web service and use a class I've written to store the information. I then store this object in a session and use it whenever needed.

While this works fine I know there must be a better way. I've recently looked into the identity framework and while it looks great I'm not exactly sure if it's the right fit for my situation. Most of the examples I look at have it work with a database to register and log in users. My users will never need to log in nor will they need to be created, at least not within the application. I basically just need to be able to store the data from the web service in the identity. Is this possible?


Solution

  • After enough looking around I was able to solve my problem. Using these links I figured out where I needed to load my user data, set my claims, and then how to use the claims to authorize my controllers.

    http://www.mytechnotes.me/2015/08/04/56/ http://leastprivilege.com/2012/10/26/using-claims-based-authorization-in-mvc-and-web-api/