Refactor auth classes and add tests

No match.