Auth systems/OAuth/Design

Features

 * To simplify the design, and to work with many of the existing OAuth client libraries that current work with Twitter's OAuth 1.0 implementation, we will start by implementing OAuth 1.0a
 * We can move to one or more OAuth 2 flows in next year if there is demand
 * This will allow users to use HTTPS or HTTP when using OAuth, since every call must be signed. To keep things simple, we may only support HMAC to start?


 * There will be an Application Registration page, for registering applications
 * If this process is usable for power users, it may enable Desktop apps, as each user would generate their own appid


 * There will be an approval page, where a logged in user will grant permissions to an application
 * Users should be warned of privacy implications
 * Should users reenter their password?
 * Allow application to update their privileges? This is not part of the specification, but should be a simple addition.
 * What's the difference between an application that already has X updating to add Y, and the application just making a new request for X+Y?


 * There will be a page where Users can see and manage their approved applications
 * See grants
 * revoke if desired


 * The MW API accepts signed requests
 * wgUser setup for the user
 * Hook ApiCheckCanExecute to authorize?
 * What is the granularity of OAuth grants?
 * By module: For most action modules, it makes sense for OAuth to grant access to the module. But for action=query with its many submodules, not so much: many are basically public information where asking permission for each module would be too much, but then some like list=deletedrevs, list=checkuserlog, and list=checkuser do need special permission. And some modules have some restricted-use features, e.g. action=edit for user css/js or protected pages or MediaWiki-namespace pages, and prop=revisions might someday get a flag to request revdeled content.
 * By user right: Again, in some places these are too granular, and in others not enough. For example, editing a page requires 'edit' and 'writeapi' (and also 'read' unless you're blindly overwriting pages), and likely 'minoredit' and 'skipcaptcha' would also be wanted, and maybe also 'createpage', 'createtalk', 'autoreview', 'autopatrol', 'autoconfirmed', and 'bot'. And at the same time you can't authorize normal edits but not edits to your user CSS/JS.
 * By adding some sort of "API rights": This solves the granularity problem, but it's a major addition. The idea here is that in addition to whatever user rights are required, each module would also require some set of "API rights" (which might depend on the query string parameters); normal password-based login would supply all "API rights" and so would work as it does now, while an OAuth session would only grant the authorized subset.

Logging

 * Lots of people gave the input that it would be desirable to log the appid, userid, and revisionid (or other identifying id for the action), to identify apps that were misbehaving.
 * Logs would only be written on edits, or api calls that made a change to the system (specifically, we will exclude any calls for searching or reading)
 * Viewing these logs would be available to a privileged user, and/or the user
 * Collection/Storage: It seems like we could use either the EventLogging system, or our own logging table, to collect and store the data
 * EL is asynchronous, which is nice. However, this would mean other MW users, who wanted to use OAuth, would either need to have EventLogging setup, or not have a log of the activity.
 * For the anticipated load, keeping the logs on extension1 would probably be fine