如何在 Camel(最好是 Blueprint)的 CXF 端点(SOAP)中实现 OAuth 流程?

How can I implement an OAuth flow in a CXF endpoint (SOAP) in Camel (preferably Blueprint)?

我想通过 camel-cxf 端点 处理 SOAP Web 服务。如何实现 OAuth 流程,最好是在蓝图中?这是可配置的还是我必须自己实施?

我觉得 documentation 不错:

基本上,您必须实现拦截器和过滤器: 你的blueprint.xml

<bean id="tvServiceClientFactory" class="org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean">
    <property name="address" value="http://localhost:${http.port}/services/oauth/validate"/>
    <property name="headers">
        <map>
            <entry key="Accept" value="application/xml"/>
            <entry key="Content-Type" value="application/x-www-form-urlencoded"/>
        </map>
    </property>
</bean>

<bean id="tvServiceClient" factory-bean="tvServiceClientFactory" factory-method="createWebClient"/>

<bean id="tokenValidator" class="org.apache.cxf.rs.security.oauth2.filters.AccessTokenValidatorClient">
    <property name="tokenValidatorClient" ref="tvServiceClient"/>
</bean>

<bean id="oauthFiler" class="org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter">
    <property name="tokenValidator" ref="tokenValidator"/>
</bean>

<bean id="myApp" class="org.myapp.MyApp"/>

<jaxrs:server id="fromThirdPartyToMyApp" address="/thirdparty-to-myapp">
   <jaxrs:serviceBeans>
      <ref bean="myApp"/>
  </jaxrs:serviceBeans>
  <jaxrs:providers>
      <ref bean="oauthFilter"/>
  </jaxrs:providers>
</jaxrs:server>