Refactor current user provider.

This simplifies the implementation of custom current user providers. (See: https://meta.discourse.org/t/amending-current-user-logic-in-discourse/10278/8)

Should be backwards compatible, all of the tests pass both with the new and old DefaultCurrentUserProvider.