GSoC-08:Secure OAuth Services

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

This is a Google Summer of Code project proposal by Sumit Kataria.

Abstract

In today's web, people do not like to share or exchange all their stuff on one service. Today, we prefer to use Flickr for photos, YouTube for videos, Amazon for shopping, etc. In order to make integration of different web services (in order to satisfy all customer/user needs), APIs using Services API in a secure fashion are used. To provide a secure way of this type of communication, OAuth is a very good option. The current system of API keys used by Services API is a combination of user name and password, but this key is too unsafe to share around on web. Also this key cannot be unshared once it is shared or handed over to other web service. The token provided by OAuth system will will provide a much safer and risk free browsing experience to users.

Integration of OAuth 1.0 core to Drupal's Service API will provide users/administrators a pluggable authentication system such that they can choose between the current system of API keys, or OAuth token system to access desired web services. The method OAuth uses is to provide “tokens” to users instead of keys. Now for each kind of web service, OAuth issues a different kind of token to user. Also, these tokens are time bound an amount of access time to another service and then it expires automatically (could be a two hour access time).

Does this mean that OAuth is like OpenID?
The OAuth approach might be considered better than the OpenID approach as users don't have to do anything to undertstand it. They just browse normally with their existing methods but in a secure manner.

OAuth integration with Service API will rescue users, and developers, who put themselves at risk by sharing their private information.

Synopsis

By means of this project, I would like to contribute a module to the Drupal community which will make the existing Service API a pluggable authentication module such that users will be able to choose between existing API keys method or OAuth method to access other web services. Drupal's existing Services API implementation is pretty weak so integrating it with open protocol OAuth will enhance security features.

Plan

  1. The main aim of project will be to put a layer of security on top of calls made Services API. Now this call from Service API will issue a token via OAuth 1.0 which will open up a separate session with remote services and then will make calls from there.
  2. OAuth core 1.0 does not presently provide any support for formats like – XML-RPX, JSON, AMF, REST, SOAP, end point detection, etc. which are used by Services API. So my aim will be here to build extensions over this to provide support for these features.
  3. Admin/users would be able to choose between existing API key methods or OAuth 1.0 token to access external web services.
  4. Developers will be able to add services over Services API using pluggable “service” module like the way they do before, but now the way of interaction of services with Services API will be using OAuth to make it more secure over current api key method.
  5. Second part of Services API the pluggable “server” module which allows support for other protocols like JSON, XML-RCP, SOAP, REST etc. will now send calls to security layer over Services API by OAuth instead of sending it directly to other web services.
  6. Now here extensions made by the student (for JSON, XML-RCP, SOAP, REST, end detection, etc.) will receive these calls and will issue a specific api key (token) according to service being called by Service API.
  7. The final api key or token issued will be using OAuth 1.0 core and will interact with requested web service without disclosing any potentially important information of user like passwords etc.
  8. This method will be good to compatible with existing methods. Also we will try to reuse the web standards the best possible way.

Future Plans

  1. Providing language support and automatically identifying this for user.
  2. OpenID integration with this.
  3. Make use of full range of available signing in algorithms.

Project Benefits To Drupal

  1. Project completion will provide Drupal a module which will could be plugged in existing Services API such that it will make use of OAuth 1.0 core to issue tokens to access other web services over web.
  2. Extensions will be build over OAuth 1.0 such that it will support features like support for XML-RCP, JSON, AMF, REST, SOAP, discovery of end point etc(calls from Services API).
  3. Site users will be able to share their private resources like photos, videos, contact lists, bank account information, etc, stored on one site with another site without giving their user names and passwords to other site. So it will make our browsing secure and risk free over web.

Derivables

  1. Investigation and learning : 1 weeks
  2. Programming Time : 7 weeks
  3. Bug Fixing and feature adding time : 3 weeks
  4. Documentation : 4 Days

Project Motivation

Drupal is a widely used and highly adopted CMS with millions of users all around the globe. With completion of my project I would be able to reach those people and will be able to make their browsing experience on web secure and risk less.

Biography

Rest in my application at google ....

Comments

Clarification...

webchick's picture

Just a clarification, because this was confusing to me. This post was actually written by Sumit; Rob just posted it... presumably because it was sent to him first? So when you see in the mentor queue that his app is basically a copy/paste of this, it's not because Sumit is plagiarizing. ;)

Note

cwgordon7's picture

Note that in your timeline, you should not leave space for learning/investigating. This should be taken care of before SoC starts so you can hit the ground running when the time comes!

Otherwise, this looks pretty good. Solid proposal.

I'd also like to see more detail in the timeline...

webchick's picture

Like turning "Coding" into a series of steps that need to be completed... "Week 2: complete the $foo functionality", "Week 3: complete the $bar component", etc. It helps us to see that you've really thought through the problem, and also helps you to make sure you're staying on task as you go through.

Djun commented tonight that someone over there is already working on something similar. He said he'd comment tomorrow to help further scope this application in order to avoid overlap.

Still wanna keep 1 week

sumitk's picture

@ cwgordon
I still wanna keep 1 week for investing more about this
Well I have reduced it from 2 weeks to 1 week, also most probable I won't need it but for now I am keeping it.

sumit kataria
pec.sumit@gmail.com

Build on existing oauth library as a start

puregin's picture

There is a php implementation of oauth by Andy Smith, one of the authors of OAuth Core 1.0, at
http://oauth.googlecode.com/svn/code/php/.

I'd strongly suggest that we use this library, appropriately packaged for Drupal. In particular, the OAuth implementation should not be too closely coupled to Services module. Rather, Services module should delegate to OAuth where appropriate.

Implementing a wrapper for the OAuth library would involve

  • fleshing out some of the sketchier parts of the library: testing and readying this for production
  • implementing a Drupal datastore for class OAuthDataStore (with a suitable install file, etc)
  • exposing the OAuth api in a Drupal-centric way
  • writing appropriate administrative UIs
  • writing sample code for Drupal implementation of Service Providers, Consumers, Protected Resources (content, actions, ...)

Keep it simple, in the spirit of OAuth. People can build all of the discovery, XML-RPC and SOAP support, etc, etc, if and when they need it.

Let's include lots of tests, as this will be a foundational piece for many distributed services.

I'd love to see this done well, as it is a crucial part of the evolving universe of lightweight, user-centric
web services.

Djun Kim
VP Research and Development, Raincity Studios

--
http://www.puregin.org

php library of OAuth is already

sumitk's picture

Thanks Kim for replying
php library of OAuth is already in my mind to start work with.
I would love to work out this module according to steps you suggested above.
Even I am keeping those as standard guidelines to start work with.
sumit kataria
pec.sumit@gmail.com

One more php library

sumitk's picture

I found one more nice php library for oauth at
http://code.google.com/p/oauth-php/
code is here
http://www.marcworrell.com/article-2990-en.html
this is used in core with anyMeta cms by Mediamatic lab (http://www.mediamatic.net)

It is implementing check for incoming OAuth requests and making OAuth requests to other services with their cms system.

sumit kataria
pec.sumit@gmail.com

+1

chrismessina's picture

Definitely use the existing PHP library as possible -- and if you want to contribute patches upstream, we're welcome to have contributions!

I'd also ask that you consider supporting XRDS-Simple/OAuth Discovery to facilitate service integration, and for Drupal sites to advertise its available API endpoints.

Update

puregin's picture

Having reviewed our client's requirements, we realized that we need to have a simple OAuth implementation well before the projected end of this project. We are committing to implement OAuth functionality via simple, clean and extensible module, as outlined in my previous comments.

I'd be very happy to work with Rob and Sumit to make sure that this provides the functionality required to support OAuth for Services, and to discuss and review additional functionality, e.g. services discovery, additional encoding, etc.

As before, we're very excited to see these changes for Services API. Good luck!

Djun

--
http://www.puregin.org

Services discovery

Richard Olsson's picture

What do you mean with services discovery, and how would you implement it? Though I can see how my asking might seem as skepticism, that is not the case as I'm just curious and interested. :)

This is what OAuth supports

Boris Mann's picture

Technically it's all "Protected Resources", but specifically listed are activities. So, for example, the Consumer asks permission to do certain activities on the user's behalf. The Service Provider has a certain set of activities (aka services) that the Consumer can do. Consumers and Service Providers may have varying ability around services, thus service discovery might be an interesting component.

The core OAuth spec only deals with actually providing the proper token etc. to access or perform such activities on behalf of the user.

I find the OAuth getting started guide a useful, very readable piece of documentation, including talking about the end user benefits.

OAuth/service Discover

sumitk's picture

Hie
sorry for late replying somehow missed it because of exams

thanks for links
rest of the discussion we are moving to project final wiki page
http://groups.drupal.org/node/10910

sumit kataria
www.buzzingblog.com

parallel goin stuff

sumitk's picture

Regarding parallel going stuff, Boris told me "there is a need for many advanced items around the base OAuth library -- including services integration. So, one route, is to propose to integrate our OAuth code with the Services module."
so I think it is fine with this project.
sumit kataria
pec.sumit@gmail.com

issue link for OAuth

sumitk's picture

Hi all
here is a link to all code and patches for OAuth and its implementation to services API
http://drupal.org/node/238814

sumit kataria
www.sumitk.net