Integrating IBM-Jazz: oAuth for OSLC API

Posted by

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)

2 comments

Leave a Reply to Kangkan Cancel reply

Your email address will not be published. Required fields are marked *