Initial work on new Authenticate library, with initial tests.