In our Web Api 2 system, Users belong to a Subscription:
public class ApplicationUser : IdentityUser
{
public Guid SubscriptionId { get; set; }
}
Users can only view data from within their owner subscription. If a user does not belong to a subscription, an unauthorised response (401) should be returned.
An example request could be something like this:
api/v1/subscriptions/{subscriptionId}/projects/
We are currently using token-based (as per this article) and Entity Framework 6 & ASP.NET Identity 2 for authentication.
What is the best way to authorize a user against a subscription?
I could create a custom authorization filter, but wouldn't retrieving the current logged in user and the subscription ID from the URL be messy?