LockerProject/Locker — pull request #510 by smurthas (2011-12-19 00:36:46+00:00)
Title: Synclet Auth Cleanup

There are few goals of this work:

0. Make it easier to build a synclet -- de-obfuscate things as much as possible!!!
1. Move all the synclet-specfic auth code into the synclet dir itself such that:
* Creating a new synclet doesn't require making changes to core files
* Synclets become more package-like -- could be pulled in from a registry, etc.

There was lots of synclet-specific code in ```Ops/webservice-synclets-auth.js``` and ```lsyncmanager.js``` -- that all got moved to ```auth.js``` files in the synclet dirs, which get required into those two files. They can specify oauth2 settings, in which case they will use common code, or simply drop out and specify their own handler function (ala twitter, tumblr, and flickr, which each use their own cute variant of oauth 1). This felt like a good balance between abstraction and flexibility. From here on out, any service using oauth 2 should require no auth code and at all, and (in theory!) no new synclets should require changes core code -- woooo!

Since there were some naming clashes, I ended up removing old connector code for Flickr, GoogleContacts, and Twitter. That feels like a step forward to me (the code was dead and confusing), but if that is a concern, it is easy to change and bring back -- I don't want these improvements to get held up as a result of something like that.