Moved authentication related stuff from database to its own class and found some bugs in the process (session caching never really worked it turns out, there was no check for ownership of server when running stop server or start server, etc.)