Integrating IBM-Jazz: oAuth for OSLC API

Friday, May 25, 2012

IBM has jazzed up their products and Jazz is the way to go. They are doing one good thing about integration, moving from traditional inconsistent API for different products to a consistent standard based API. And the standard is OSLC (Open Services for Lifecycle Collaboration).

But for .NET people, stepping into IBM products is always need some additional effort as the support system is not very active on .NET based technologies.

This is to share some initial exploration and results for such an integration.

We were working on a .NET client for integration with Jazz RRC. The scenarios include creation, updating and selection of requirements from RRC. The initial hiccup was implementing oAuth for authenticating to be able to access RRC. Frankly, I have never worked on oAuth, and thus this itself was a challenge for me. But, thanks to various other service providers or systems that provide services on REST and oAuth based authentications. The one that helped me is a topic that describes implementation of oAuth for LinkedIn (URL: http://developer.linkedin.com/thread/1346). So I started with this. I learned that one need the following things before starting. It was an uphill task to find it out as the documentation is poor and raising a PMR or asking on the stagnant IBM Jazz forum does not help all the time.

One tool that helped me significantly is the REST Client on Firefox (why is it not there for IE?). You may have it here: https://addons.mozilla.org/en-US/firefox/addon/restclient/

The initial part of the code is as follows:

        private string _consumerKey = "c767bhsd60a41d3ab3e5dff6368968c";
        private string _consumerSecret = "J0bj4I0%2B8%MPuRool32NK0n7hQp6WXCUhoOe363mLOc%3D";

        public enum Method { GET, POST, PUT, DELETE };
        public const string USER_AGENT = "JazzOslc";
        public const string REQUEST_TOKEN = "https://myJazzServer:9443/jts/oauth-request-token";
        public const string AUTHORIZE = "https://myJazzServer:9443/jts/oauth-authorize";
        public const string ACCESS_TOKEN = "https://myJazzServer:9443/jts/oauth-access-token";
        /*Should replace the following URL callback to your own domain*/
        public const string CALLBACK = "https://myJazzServer:9443/rm/web";



So this means, I need to figure out the values for all these.

After lots of searching, I stumbled upon the server admin interface and could see a way to generate the customer secret and key. So I created one. For the readers, who want to follow the same footsteps, please go this way: Click on the Administration icon at the top right of the dashboard. You will reach Jazz Team Server Home. Click on the "Consumers (Inbound)" link in the left navigation area.

Now, armed with these two information, the next was tricky again. After much trial and error, I could see all the details required by querrying the rootservices https://myJazzServer:9443/rootservices using the REST Client.

So, the next step is working on the OSLC oAuth class that will help me authenticating. I just followed the Facebook example and updated the attributes as needed. The outcome was flawless, I could get it done.

You may look at the code in the attachement

This topic include the authentication part only. I shall update the next parts in the near future.

OSLCoAuth.zip (43.79 kb)

Comments (2) -

rosaUnited Statesrosa said:

Hello
The OSLC workshop on Jazz.net has a working sample with OAUTH authentication along with other RM OSLC
Samples.  
http://jazz.net/library/article/635

KangkanIndiaKangkan said:

The sample is good, but could not port the code to .NET, it seems. The form based authentication as in example lab 6.3 is not working on .NET. See more here: jazz.net/.../how-can-i-do-the-oauth-authentication-from-another-webcontrol

Pingbacks and trackbacks (1)+

Add comment

biuquote
Loading