I have two OSGi
bundles deployed in Apache Karaf
. A
and B
. My A
OSGi
bundle works as basic authentication handler. I have set up my security handler it works fine:
<bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
<property name="authenticator">
<bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/>
</property>
<property name="constraintMappings">
<list>
<ref bean="constraintMapping"/>
</list>
</property>
<property name="loginService" ref="loginService"/>
<property name="strict" value="false"/>
<property name="identityService" ref="identityService"/>
</bean>
This handler is in bundle A
. What I need to do is to make this handler as an OSGi
service to be used by other bundles, in this case, by bundle B
. I can not implement any interface to ConstraintSecurityHandler
class because it is from org.eclipse.jetty.security
package.
I have tried to create my own Handler class then extend ConstraintSecurityHandler
and implement my interface. So OSGi
service looked like this:
<osgi:service ref="securityHandler" interface="my.company.MyInterface" />
This does not work, I get the exception:
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route[[From[jetty:http://0.0.0.0:8019/TARGETjobs/Indeed?hand... because of Failed to resolve endpoint: jetty://http://0.0.0.0:8019/TARGETjobs/Indeed?handlers=securityHandler&matchOnUriPrefix=true due to: null
So the question is how can I make this securityHandler
bean as an OSGi
service available to other OSGi
bundles?