Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authenticating WCF Rest webservices

I have a created webservice REST Webservice in C# without any authentication. Now, i am looking into adding authentication to the webservice. The webservice exposes 6 methods (all are GET), out of these 6 methods, i want to restrict the access of 2 methods to member of "Admin" group. Currently, my webservice is hosted on a ConsoleHost. The consumer of this service would be in same domain (typically another application), so if I am able to pass in domain/username (Windows Credentials) of the client to the webservice. I can check in the webservice to find if that user is part of "Admin" group or not.

My question is how do I pass logon credentials of the client to the service. I think, I could use authentication header, but I did not find a good resource to learn about usage of authentication headers in REST Webservices. Are there any other ways to authenticate webservice consumer?

Once the webservice is hosted, I can type in the url of the service (like any other webpage) in a browser and access the resource. How would authentication work in that case?

like image 972
VikasGupta Avatar asked Jan 14 '11 06:01

VikasGupta


1 Answers

Maybe this guide will help you?

http://msdn.microsoft.com/en-us/library/dd203052.aspx

Particularly the section about "Implementing Authentication and Authorization"

like image 129
intodev Avatar answered Oct 19 '22 10:10

intodev