An app I’m working on interfaces with an existing application running on a remote box. Communicaitons with the remote app are via its public web services. I’ve been asked to build an enhancement which will involve a client making use of the web service to handle sensitive data which will need to be transmitted securely.
Could anyone give me some pointers on how best to proceed?
To start, you should be using SSL and reject any requests that are not using it. This will encrypt data as it’s being transmitted over the Internet.
If you are using SOAP, you could define a custom header in your service that takes a username / password. Then, for the first line in each public method, validate the username and password against a database. If successful, set the HttpContext.Current.User appropriately, and your service will tie in nicely with the built in Asp.NET infrastructure.
ADDED: Below is a sample SoapHeader that includes a username / password for authentication.
Now, if you run the wsdl tool, the generated proxy class will include the defined authentication header: