Skip to Content
Author's profile photo Leo van Hengel

iGoogle Gadget (featuring UWL,BPM,JSON & OAuth) – Part 2


In my previous iGoogle Gadget (featuring UWL,BPM,JSON & OAuth) – Part 1 I described how to retrieve BPM Tasks from the Universal Worklist and present the data as JSON. This blog shows how to create the OAuth Provider and in part 3 we will create the iGoogle Gadget as the OAuth Consumer application which will display the data from the Tasks from the Provider in our own iGoogle page.</p>



OAuth is an open protocol to allow secure API authorization in a simple and standard method from web, desktop, and mobile applications.

OAuth provides a method for clients to access server resources on behalf of a resource owner (such as a different client or an end-user). It also provides a process for end-users to authorize third-party

access to their server resources without sharing their credentials (typically, a username and password pair), using user-agent redirections.

For the application used in this blog series SAP NetWeaver will act as the OAuth Provider and iGoogle is the OAuth Consumer. The OAuth Authentication flow between the end user, consumer and provider is displayed in the following diagram:




In the diagram above the OAuth Authentication flow is done in ten steps:

  • OAuth Provider grants Request Token
  • Redirect to Service Provider Login
  • User Grants Access
  • Redirect User to Consumer
  • Redirect to Consumer
  • iGoogle Request Access Token
  • OAuth Provider Grants Access Token
  • Access protected Resource
  • Return protected Resource

          For  info about OAuth i can recommend the slides by Leah Culver at slideshare and the documentation at


OAuth Provider

Now let’s create an OAuth Provider which runs on NetWeaver CE 7.2. To do this i used the example provider which is freely available at Google Code [ |]

You can download example code for almost every platform but offcourse we use the Java version and more specific the web provider version. This web application consists of:

    1. SampleOAuthProvider (Core Java class for the OAuth Provider)
    2. Servlets (RequestTokenServlet, AuthorizationServlet and AccessTokenServlet the 3 servlets which the consumer communicates with)
    3. JSP files (JSP pages for authorization)

You can download the necessary files at:



            We will continue with the same Web Module Project as used in iGoogle Gadget (featuring UWL,BPM,JSON & OAuth) – Part 1 of this blog and extend this web application with OAuth functionality.

            From the oauth-providerweb directory copy all files and directories to the WebContent directory. The current web.xml can be overwritten because we don’t need the Test Servlet anymore.

et *directory copy all files and directories to the
source directory of the project.

            First we will refactor the SampleOAuthProvider class to UWLTaskOAuthProvider. Right-click on the file name and select Refactor-> Rename. Fill in the new name and click Finish.


          In the same directory as the UWLTaskOAuthProvider you will find a resource file: This files is used by the OAuth provider to hande multiple consumer apps. We will add the specific properties needed for our iGoogle Gadget:–-BEGIN CERTIFICATE
<br />A1UEChMKR29vZ2xlIEluYzEXMBUGA1UEAxMOd3d3Lmdvb2dsZS5jb20wHhcNMDgx
<br />ADCBiQKBgQDQUV7ukIfIixbokHONGMW9ed0E9X4m99I8upPQp3iAtqIvWs7XCbA
<br />bGqzQH1qX9Y00hrQ5RRQj8OI3tRiQs/KfzGWOdvLpIk5oXpdT58tg4FlYh5fbhIo
<br />VoVn4GvtSjKmJFsoM8NRtEJHL1aWd
<br />MIHCMB0GA1UdDgQWBBSm/h1pNY91bNfW08ac9riYzs3cxzCBkgYDVR0jBIGKMIGH
<br />gBSm/h1pNY91bNfW08ac9riYzs3cx6FkpGIwYDELMAkGA1UEBhMCVVMxCzAJBgNV
<br />gCcYtmdyd8rh/FKeZm2me7eQCXgBfJqQ4dvVLJ4LgIQiU3R5ZDe0WbW7rJ3M9ADQ
<br />FyQoRJP8OIMYW3BoMi0Z4E730KSLRh6kfLq4rK6vw7lkH9oynaHHWZSJLDAp17cP
<br />j
<br />

The public RSA-SHA1 key from Google is added because iGoogle uses the RSA_SHA1 signature method for signing the requests. Useally the provider should provide such a key, but to make it easy we use the default one provided by Google.

          This way we don’t have to do a manual registration of our Gadget with Google. See for more info




What we created is a simple OAuth Provider, which stores the username/password in memory (HashSet in the UWLTaskOAuthProvider). So after restarting/deploying the web application again these value are gone.

A nicer option would be to persist these values in a database for example.

The main functionality of the OAuth Provider consists of the following resources:

    1. (central class for the OAuth Provider)
    2. (servlet used for getting the Request Token see step 1 in the OAuth flow diagram)
    3. (servlet used for Authorization see step 4 in the OAuth flow diagram)
    4. (servlet used for getting the Access Token see step 7 in the OAuth flow diagram)
    5. (servlet for retrieving the UWL Tasks see step 9 in the OAuth flow diagram)

In the final blog the iGoogle Gadget will be created which will act as the OAuth Consumer to show the Tasks to the user in the iGoogle page.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.