First hack at x509 auth

Posting this mostly for comments.  I haven't looked at writing the required tests yet.
Sure.  Take a look at the latest update and let me know if it looks ok.  I slightly improved the comment too.