WCF custom authentication using ServiceCredentials

03 April, 2015.

The generally accepted way of authenticating a user with WCF is with a User Name and Password with the UserNamePasswordValidator class. So common that even MSDN has a tutorial, and the MSDN documentation for WCF is seriously lacking at best. The username/password approach does what it says on the tin, you pass along a username and password credential from the client to the server, do your authentication, and only if there is a problem then you throw an exception. It’s a primitive approach, but…

Continue reading

Easy WCF Security and authorization of users

19 July, 2014.

There are several steps involved in making your WCF service secure, and ensure that clients consuming your service are properly authenticated. WCF uses BasicHttpBinding out-of-the-box, which generates SOAP envelopes (messages) for each request. works over standard HTTP, which is great for completely open general purpose services, but not good if you are sending sensitive data over the internet (as HTTP traffic can easily be intercepted). This post discusses how to take a basic WCF service…

Continue reading

How to create a RESTful web service using WCF (Part 3 of 3)

04 April, 2014.

RESTful (Representational State Transfer) web services use HTTP verbs to map CRUD operations to HTTP methods. RESTful web services expose either a collection resource (representational of a list) or an element resource (representational of a single item in the list). Other parts in this series: How to create a RESTful web service using WCF (Part 1 of 3) How to create a RESTful web service using WCF (Part 2 of 3) Testing the WCF service using Fiddler If you haven’t come across Fiddler before, its…

Continue reading

How to create a RESTful web service using WCF (Part 2 of 3)

03 April, 2014.

RESTful (Representational State Transfer) web services use HTTP verbs to map CRUD operations to HTTP methods. RESTful web services expose either a collection resource (representational of a list) or an element resource (representational of a single item in the list). Create the WCF service contract Every WCF service begins with a service contract. A service contract defines what operations are supported/provided by the service. An operation contract is the definition of a method that can be…

Continue reading

How to create a RESTful web service using WCF (Part 1 of 3)

02 April, 2014.

RESTful (Representational State Transfer) web services use HTTP verbs to map CRUD operations to HTTP methods. RESTful web services expose either a collection resource (representational of a list) or an element resource (representational of a single item in the list).HTTP verbs are used as follows; Create (POST) > create a new resource. Read (GET) > retrieve one or many resources. Update (PUT) > update an existing resourπce. Delete (DELETE) > delete an existing resource. This tutorial…

Continue reading

Consuming a WCF service without adding a Service Reference

29 July, 2013.

A problem I have had with WCF since I first discovered it a few years ago is related to Service References. The fact that I have to rely on the ServiceModel Metadata Utility Tool (Svcutil.exe) to generate a proxy class on my behalf left a sour taste in my mouth. A good solution would be for me to be able to write code myself to take this pain away. A Simple Approach One approach to do this is to take over the responsibility of creating bindings and endpoints yourself in your consuming…

Continue reading