开发者

Eclipse RCP question on managing authentication token

开发者 https://www.devze.com 2023-03-13 14:45 出处:网络
I am developing an Eclipse RCP application. I allow the user to login using a login dialog. Login logic is coded in a seprate handler. Users can create business objects in other views only after succe

I am developing an Eclipse RCP application. I allow the user to login using a login dialog. Login logic is coded in a seprate handler. Users can create business objects in other views only after successful login. SO I want the authentication token to be available in my view. Is there any concept like HTTP session pa开发者_如何学编程rameters in RCP.I am thinking of storing the authentication token after user successfully login and then use it for allowing him to create the business object in other view. I want to do it in standard way instead of caching the token in some files. Let me know if you have any suggestions.


There are no "standard way" to manage application wide data in RCP. I usually use the org.eclipse.ui.servicesextension point (see the description of this) to setup a service all components can use, but an OSGi service is a likely alternative.

Or you can get very simple and just use a common static class :-)


If i understand you correctly you want to be able to limit the possibilities when a user is not logged in.

i know two standard ways to achieve this:

  1. Use an ISourceProvider
  2. Use the org.eclipse.ui.activities extension point

I would use an ISourceProvider if there are only a few different states (logged-in or not) or if there are just a few handlers that need to be handled.

I would use the Activities extension point if there are several different roles or if there are lots of (different) components (perspectives, views, editors, wizards, preference pages, menus, toolbars, commands, ...) that need to be handled.

0

精彩评论

暂无评论...
验证码 换一张
取 消