Move auth code to serverauth.h