Fixed AuthenticationProvider and updated tests.