Use OAuth instead of Basic Authentication with Plain Java API
Hello everyone,
We're currently working with the Plain Java API and we've been using the authentication with user and password as a way to obtain the ITeamRepository.
For Basic Authentication we're using the registerLoginHandler function as follows:
ITeamRepository repository = TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryAddress);
repository.registerLoginHandler(new ITeamRepository.ILoginHandler() {
public ILoginInfo challenge(ITeamRepository repository) {
return new ILoginInfo() {
public String getUserId() {
return user;
}
public String getPassword() {
return password;
}
};
}
});
repository.login(monitor);
Now we want to try out the token-based Authentication and I noticed there's this function in ITeamRepository:
void registerOAuthHandler(IOAuthHandler var1);
but I did not find any example how to use it.
Could you please let me know if there's any examples? I looked a bit in the Javadocs but I could not find anything useful.
Thanks in advance,
Ana
|
2 answers
Ralph Schoon (63.6k●3●36●46)
| answered Jun 29 '23, 10:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER If you follow https://jazz.net/library/article/1000 and set up the development environment based on Lab 1 until end of Lab 1, you can search for references in the EWM/RTC SDK. There are very few (like 3) examples how this is used in the SDK. |
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.
Comments
Ralph's answer below will go in the POJO in detail.. I have also created a few blog posts which will explain the Oauth 1.0a and OIDC methods from a rest perspective -- OIDC - https://michaelrowe01.com/index.php/day-job/ibm-elm/api-authentication-method-in-elm-oidc/