Add initial working version of checking authentication with tests.