I have to create a WCF service which returns sensitive information to the client. I need to ensure that the security of the service cannot be compromised easily. I'll use WCF's built in security mechanisms to protect the data on the wire by using a wsHttpBinding with certificate security.
However, I also want to ensure that the service's security cannot be compromised by modifying the config file. I want to retain all the flexibility the config file affords in terms of ports, base addresses etc. but ignore any endpoint/binding related configuration sections that could compromise the service.
What I thought of doing is this: Create a custom service host in which I override the ApplyConfiguration function. In the ApplyConfiguration function I can do one of two things:
- Load only the sections in the config file that I need with base.LoadConfigurationSection.
- Load the entire config file with base.ApplyConfiguration and removing all endpoints that could compromise security.
I am new to WCF so any guidance on how to do this properly would be appreciated (with code samples if you can :-) ). I don't know if I am on the right track here!