Refactor of the external logins 

Had this branch lying around for a while. The changes decouple the OAuth web security stuff from our code, and also allow the icons for the OAuth providers to be configured in the app settings.
It was useful for debugging when it wasn't working correctly. It is also used later in the method (although that usage could be replaced with a call to the dictionary as well, but I don't think it is as clear).