Eclipse RCP question on managing authentication token
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.services
extension 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:
- Use an ISourceProvider
- 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.
精彩评论