Tuesday, August 11, 2009

New in Edge Rails - Active Resource Enhanced SSL

Active Resource is incredible and makes using web services a breeze but it was lacking when it came to connecting to services over ssl. This past weekend an upgrade was added to edge rails that allows you the ability to define the certificate validation you require and gives you the ability to use x509 certificates. Below is an example of the new use case as described in the documentation:

# End point uses an X509 certificate for authentication. See ssl_options= for all options.
# class Person < ActiveResource::Base
# self.ssl_options = {:cert => OpenSSL::X509::Certificate.new(File.open(pem_file))
# :key => OpenSSL::PKey::RSA.new(File.open(pem_file)),
# :ca_path => "/path/to/OpenSSL/formatted/CA_Certs",
# :verify_mode => OpenSSL::SSL::VERIFY_PEER}
# end

Though this is may not be used by a large number of people it provides a great deal of flexibility for using Active Resource over ssl.

No comments: