I am trying to implement security for the WCF rest service which will be exposed over the net for consuming. Here are the requirements
Authorization for Service and Specific API's
The service should authorize the partner and check if the partner has the access to the API which is called and i have multiple partners calling these restful APIs.
How do I authorize each of these partners for APIs in a centralized way?
Authentication for the User
I need to perform Authentication for users in order to perform the Add,Delete operations.
How do I authenticate the users for specific APIs in centralized way.
Look at Azure Storage REST api security documentation here to get a fair idea about how MS has designed security around their API.
Most of the REST API i have seen use a API token based approach where these tokens are passed along each request to identify the caller. Also look at this thread
I used the following appraoch to implement the Authorization and Authentication fot the rest services.
Used the Custom Attribute which Implements the Attribute, IOperationBehavior, IParameterInspector
Here is the Implementation.
Implemented a custom Beahavior to handle the exceptions.
Then implemented the IErrorhandler to send the status code and description if the Authorization or authentication fails.