Add pluggable security (authentication and encryption)

Also add a no-op security factory which is also the default. Other
factories (user-written) can be plugged in to use SSL, SASL, Kerberos,
or other types of authentication and encryption.