Creating user in TomCat using IExternalUserRegistryManager
One answer
I used the following code snippet.
IContributorManager contributorManager = repo.contributorManager();
String groups[] = {"JazzUsers"};
String user_id = "test";
// create a user into "Tomcat" External User Registry
String user_name = "TEST";
String password = user_id;
String email = user_id+"@my.com";
userRegistryManager.addExternalUser(user_id, password, user_name, email, groups, monitor);
System.out.println("Add user to Tomcat.");
// create a user into Jazz DB
IContributor contributor = (IContributor) IContributor.ITEM_TYPE.createItem();
contributor.setUserId(user_id);
contributor.setName(user_name);
contributor.setEmailAddress(email);
contributorManager.saveContributor(contributor, monitor);
System.out.println("Add user to Jazz.");
IContributorManager contributorManager = repo.contributorManager();
String groups[] = {"JazzUsers"};
String user_id = "test";
// create a user into "Tomcat" External User Registry
String user_name = "TEST";
String password = user_id;
String email = user_id+"@my.com";
userRegistryManager.addExternalUser(user_id, password, user_name, email, groups, monitor);
System.out.println("Add user to Tomcat.");
// create a user into Jazz DB
IContributor contributor = (IContributor) IContributor.ITEM_TYPE.createItem();
contributor.setUserId(user_id);
contributor.setName(user_name);
contributor.setEmailAddress(email);
contributorManager.saveContributor(contributor, monitor);
System.out.println("Add user to Jazz.");