に 2 つのOSGi
バンドルを展開していApache Karaf
ます。A
とB
。私のA
OSGi
バンドルは、基本認証ハンドラーとして機能します。正常に動作するセキュリティ ハンドラをセットアップしました。
<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>
このハンドラは bundle にありA
ます。私がする必要があるのは、このハンドラーをOSGi
他のバンドル (この場合は bundle ) によって使用されるサービスとして作成することB
です。パッケージConstraintSecurityHandler
からのものであるため、クラスへのインターフェイスを実装できません。org.eclipse.jetty.security
独自の Handler クラスを作成してからConstraintSecurityHandler
、インターフェースを拡張して実装しようとしました。したがって、OSGi
サービスは次のようになります。
<osgi:service ref="securityHandler" interface="my.company.MyInterface" />
これは機能しません。例外が発生します。
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
問題は、このsecurityHandler
Bean をOSGi
サービスとして他のOSGi
バンドルで利用できるようにするにはどうすればよいかということです。