helper function for building Auth classes