It's all about the answers!

Ask a question

[closed] Login to RTC using server-side Java API


Luca Martinucci (1.0k294112) | asked Dec 10 '15, 6:14 a.m.
closed Aug 17 '18, 4:27 p.m.
I would like to login to RTC with some specified credentials using server-side Java API.
I need to insert this code in an Event Handler in order to perform an action with a different user from the one who has caused the plugin to run.
I have already done such a thing using client-side plain Java API; is this possible using server-side classes (from RTC SDK) as well?
I am working with RTC 5.0.2.

The question has been closed for the following reason: "Problem is not reproducible or outdated" by lumar Aug 17 '18, 4:27 p.m.

One answer



permanent link
Michele Pegoraro (1.8k14118103) | answered Dec 11 '15, 11:24 a.m.
Luca,
working on server side you are already connected to RTC. I think you want to CHANGE your credential as event handler work as "admin" user that could not be inserted in any roles. If this is what you want you have to use IImpersonationService to change credentials when you perform actions like save work item or other.

Comments
Luca Martinucci commented Dec 14 '15, 3:26 a.m.

Michele,
this is what I actually did.
The impersonation works fine, but it has one limitation: you can only "impersonate" somebody else only if you have JazzAdmins privileges.
This makes it unusable in most cases.
It would be nice to find a way to programmatically login to the RTC server using the SDK.


Michele Pegoraro commented Dec 14 '15, 6:09 a.m.

Yes, I know. But if you work with event handler you already have it as the class is triggered by admin user. The problem is with pre-conditions and follow-up action. I think it would be really useful if impersonation will be extended to other privileged users, but by now I've seen no progress on this. I don't think another login makes sense because in this case you are already connected: it would only brings to further problems.


SEC Servizi commented Apr 12 '19, 5:09 a.m. | edited Apr 12 '19, 5:11 a.m.
The impersonation works fine, but it has one limitation: you can only "impersonate" somebody else only if you have JazzAdmins privileges. 

Well, on server side exists a "trick" to impersonate ADMIN user, which of course has JazzAdmins privileges: TeamServiceContext#runAsAdmin ;)

Cheers.