Update chttpd_auth_cache for new couch_auth_cache

This updates the interface to chttpd_auth_cache to match the new
callback API expected by couch_httpd_auth. Specifically this allows for
the upgraded user documents to be written back to the correct user
database.

COUCHDB-2491
Refactor couch_httpd_auth's AuthModule construct

We were missing the change necessary to upgrade user documents with the
move to pbkdf2 in a cluster. This also adds the ability for an
AuthModule to return a context that will be used when updating user
credentials.

COUCHDB-2491
Export session utility functions

Other auth solutions will want to reuse these functions. These should
probably be moved to a separate auth utility module but this seems like
the most prudent course of action.

COUCHDB-2491
Add system db handlers to fabric_doc_update

This hard codes the before_doc_write functions for replicator and user
databases like they are in couch_server. This is mostly motivated by the
fact that couch_users_db:before_doc_update/1 adds random salt values to
user documents when a password is changed. The replicator databases are
included at this level for consistency with couch_server.

COUCHDB-2510
Merge branch '2491-refactor-couch-httpd-auth'

Fixes #21
Merge branch '2491-refactor-couch-httpd-auth'

Fixes #13
Merge branch '2510-add-system-db-handlers'

Fixes #6
harden bulkDelete test

sometimes it has false positives
Make deleteDatabase test in Nightwatch more specific
Merge commit 'f7930207674a02b0bc3f037313f29590d08a49b5'
Merge commit 'a4dbd6413f37b51ad9504b6a04e9e04c23e856bf'

Conflicts:
	apps/couch/src/couch_httpd_auth.erl
	apps/couch/src/couch_httpd_oauth.erl
Merge commit '9e87f8b3fd827d322390fad2ab38f34f0a29858e'
Merge commit 'bf1b42833d9bd17aeb94f8a28b06be02dd1a177c'