Pluggable user support

Implements #62. Supercedes #93.

Please provide some feedback on this for usage with an actual custom user model - there seems no proper way to user custom user models in automated tests.