Wednesday, April 24, 2013

Savon for webservices; easy enough to add OpenSSL::X509::Store support

I have been looking around for a library to handle interacting with webservices for testing purposes.  I used to use soap4r.  I saw soap4r-ruby1.9, but I also saw Savon.  I like trying new things out, so I gave it a shot.  The server I'm hitting requires 2-way authentication, but it doesn't use a CA authority.  The server and the client authenticate with each other based on their trust stores which contain the others public certificate.  Unfortunately, Savon didn't support this method of authentication as it doesn't expose a way to add trusted certificates to the configured request. 

Perhaps this is because Savon strives to provide a common interface for multiple adapters.  Perhaps a little short-sighted, I plowed on ahead to add the means of configuring a trust store instead of using a CA certificate for authentication.  The implementation strives to keep consistent with the other related SSL calls with Net::Http in mind; I really don't know what the other adapters will do with those extra features.  Some testing is still in order; the question of whether this change is feasible for the other adapters can more appropriately be answered when unit tests have been added.

In the mean time, I can go ahead with my webservice testing.  I have put the following together to carry out that testing:

Incorporates use of trusted key stores for certificate authentication (with peer).
git clone git@github.com:dcvezzani/savon.git
git clone git@github.com:dcvezzani/httpi.git
Examples using Net::Http, Httpi and Savon (you will need to configure your own web server, but there is a script to generate both service and client certificates).
git clone git@github.com:dcvezzani/freezing-sansa.git

And here's what it looks like. Just provide an array of filenames representing the trusted files that should be in the store and authentication will take place using your store instead of a CA certificate and chain.

No comments:

Post a Comment