Move authFactory to its own file