I would like to implement a REST api on an existing ASP.NET MVC website. I was able to configure WCF data services so that I can view my data, but now the question is how to handle authentication.
At the moment, the data service is protected through the site created as a result of forms authentication, and this is normal when accessing the service from AJAX forms. However, it is not ideal for a RESTful api.
What I would like as an alternative to validating forms is simply for users to simply paste the username and password into the web service URL or as request parameters.
For example, if my web service is usually available as
http:
I would like to have access to it using the URL
http://localhost:1234/api.svc/{login}/{password}
So my questions are:
It seems like a trivial redirection of GET requests so that the username and password are attached as GET parameters. I also know how to check the http context and use these parameters to filter the results. But I'm not sure if / can use the same approach to POST, PUT and DELETE requests. Can I use GET parameters in POST, PUT and DELETE requests?
Edit: The question is how to embed the username and password in the web service URL so that I can execute POST, PUT and DELETE requests to the web service. I know how to implement authentication when the web service is started and the username / password is contained somewhere in the HTTPContext. Also, I'm not looking for ways to implement forms or basic authentication. I know how to do this, but that’s not what I am looking for.
source share