I have made a simple RESTful Web Service (GET-only, for now) using the Microsoft ASP.NET MVC 4 ApiController.
Now I'm looking for the right way of implementing an authorization system for the service. I know I don't want to use the built-in FormsAuthentication, since I don't want to have a unique login page for all the applications using my WS; moreover, that breaks the RESTful paradigm, forcing a redirection and not notifying the client with the proper 401 status code.
So I have disabled FormsAuthentication deleting the following lines from my web.config:
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
and adding the following:
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthentication" />
</modules>
I already have an ApiController for managing the User login, which basically checks the credentials against my database and returns the user or a 401 if the credentials are not valid.
I have read that I have to implement the Membership and Authorization API, but I found nothing that helps me doing from scratch.
Do you have any ideas? Do I need to manage cookies and authcodes on the database or is there a similar class to FormsAuthentication that does it for me?