Moved authentication logic around. Added support for new Bula-Auth middleware, and moved model logic into model.