Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Custom TrustEngine with Equinox servlet bridge
Custom TrustEngine with Equinox servlet bridge [message #1014443] Mon, 25 February 2013 15:55 Go to next message
Michael Yara is currently offline Michael Yara
Messages: 27
Registered: July 2009
Junior Member
Hello,

I am creating an application that contains an embedded Jetty web server that launches several instances of the OSGI Equinox servlet bridge. I want to take advantage of the bundle security mechanism available in Equinox via a custom TrustEngine implementation. I have the following set in my config.ini for each of the equinox instances. osgi.signedcontent.support=authority, osgi.signedcontent.authorization.engine.policy=trusted and osgi.signedcontent.trust.engine=BundleTrustEngine. The name of my implementing TrustEngine class is "BundleTrustEngine". My question is where should the BundleTrustEngine class sit in my application so that the OSGI Equinox servlet bridge can have access to it or how do I expose this implementation to the OSGI Equinox servlet bridge instances?

Thank you,
Mike
Re: Custom TrustEngine with Equinox servlet bridge [message #1014506 is a reply to message #1014443] Mon, 25 February 2013 19:13 Go to previous message
Michael Yara is currently offline Michael Yara
Messages: 27
Registered: July 2009
Junior Member
I was able to answer my own question with some research and trial and error.

Here is the solution:

First you want to implement a Framework adapter hook. I followed the Hello Adaptor Hook example in the following pdf

http://www.eclipsecon.org/2008/sub/attachments/Equinox_Framework_How_to_get_Hooked.pdf

In the adaptor package that you created add your implementation of TrustEngine. Mine was called BundleTrustEngine.

Next fill out the frameworkStart() method in your AdaptorHook class with the following in order to register your TrustEngine:

Hashtable<String, Object> properties = new Hashtable<String, Object>();
properties.put(Constants.SERVICE_RANKING, new Integer(Integer.MAX_VALUE));        
properties.put(SignedContentConstants.TRUST_ENGINE, "BundleTrustEngine"); 
context.registerService(TrustEngine.class.getName(), new BundleTrustEngine(), properties);


Replace "BundleTrustEngine" with the name of your TrustEngine implementation class.

Next set the following as runtime properties of the application using -D or specify them in your config.ini file.

osgi.framework.extensions=com.xmlnamespace.equinox.hook
osgi.signedcontent.support=all
osgi.signedcontent.authorization.engine.policy=trusted
osgi.signedcontent.trust.engine=BundleTrustEngine

The osgi.framework.extensions should be set to the name of the bundle that houses your Adaptor hook.

You may also want to look at the following articles on how to properly deploy your adaptor hook:

http://wiki.eclipse.org/Adaptor_Hooks

I have not got to the part where I have included this in my embedded application but I am guessing that you simply have to export your adaptor hook bundle fragment jar and included it in the WebContent/WEB-INF/eclipse/plugins directory of the equinox servlet bridge war and repackage the war file.

[Updated on: Mon, 25 February 2013 19:16]

Report message to a moderator

Previous Topic:Running Equinox application on 64bit Java / Solaris
Next Topic:How to change bundle start level in glassfish 3.1.2?
Goto Forum:
  


Current Time: Thu Apr 17 03:51:39 EDT 2014

Powered by FUDForum. Page generated in 0.13138 seconds