finishes authentication for users. writes all test needed.