It's all about the answers!

Ask a question

How to programmtically get the OAuth friends server secret?


Jing Qian (12632) | asked Jun 04 '12, 4:08 p.m.
JAZZ DEVELOPER
Currently, we run a background asynchronize task which checks the RTC build system for new build record every x seconds.

We asked user to set up RTC as a friend server, and also set up a functional user on the RTC server to associate with this OAuth consumer.

Now the question is how can I programmatically get the friend secret from the friends(outbounds) side?

So I could send over the key and the secret to establish the connection using JazzHttpClient?

Thanks

One answer



permanent link
Todd Lainhart (40611) | answered Jun 04 '12, 4:13 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hi Jing -

If your background task is derived from AbstractService, then do something like the following:

    /**
     * Returns the OSGi friends service.
     * @return The friends service. Never <code>null</code>.
     */
    IInternalFriendsService getFriendsService() {
        return getService(IInternalFriendsService.class);
    }

...to return the FriendsService (this dependency will need to be declared as a dependency in your service's plugin.xml).  With the returned FriendsService, get the friend for the RTC target URL, as in:

   getFriendsService().getFriendsConfig().getFriendMatchForOauthDomain(uri)

The returned friend will contain the OAuth key and secret.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.