に 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
問題は、このsecurityHandlerBean をOSGiサービスとして他のOSGiバンドルで利用できるようにするにはどうすればよいかということです。