neo4jrb/neo4j-core — pull request #139 by subvertallchris (2014-12-03 00:28:10+00:00)
Title: Neo4j authentication working, needs specs

This is not ready for merge but I'm starting the PR to raise awareness. Let's keep pushing to this branch until it's ready to go.

The first milestone release of 2.2 should be out any day. One of its new features is built-in basic auth. In a fresh installation, it will require an immediate password change and then you must supply the user/pass on each connection. The changes here do the following:

Done:
* Checks for the presence of built-in auth. If it's disabled, nothing changes.
* If it is enabled, it looks for the user and pass in config params
* If user and pass are missing or invalid, it returns appropriate errors
* If user and pass are valid but a password change is required, it returns a different error
* If user and pass are valid, it obtains a token and configures the headers for its use.

To do:

Specs:
* Stub the method that checks for the presence of built-in auth, tell it that it doesn't exist, make sure everything works correctly when basic auth params are given.
* Stub the various response states, ensure that it raises the right errors.
* An e2e test showing that it correctly obtains an auth token at the beginning of the suite since it will be enabled by default.

New Rake tasks:
* One to change the password after first install
* Another to enable or disable auth
* One more to invalidate auth tokens/logout

Rake task modification:
* Our installation tasks should disable authentication. I think the tasks are mostly used in dev and test environments, where security isn't an issue. If someone really wants to enable auth, they'll have a rake task to do it.