I've set up ASP.NET Identity 2 in my MVC app to authorize users for both standard pages and Web API calls. Simply adding the [Authorize]
attribute (with a few fixes) works just fine for preventing unauthorized access, but I also need the ability to get the current IPrinicple
in the same way that I would use User.Identity
in my MVC views and controllers. There are some things I can accomplish by using it in my views and controllers before they are handed off to Angular, but I also need to be able to read this value for things like creating menus based on the current user's role.
I've considered reading the ASP.NET Idenity cookies, but this requires decryption of the cookie, which I obviously won't be able to accomplish on the client side without revealing the decryption key.
Is there a way to pass off the User.Identity
to Angular.js in a way that's consumable by the client side code?