Move GetExternalAuthTypes to template, and clean up