本文介绍了如何在Camel(最好是Blueprint)的CXF端点(SOAP)中实现OAuth流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I would like to address a SOAP web service via camel-cxf endpoint. How can I implement an OAuth flow, preferably in the blueprint? Is that configurative or do I have to implement it myself?

推荐答案

我发现不错的文档对此:

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

Basically, you have to implement interceptors and filters:Your 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>

这篇关于如何在Camel(最好是Blueprint)的CXF端点(SOAP)中实现OAuth流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 00:05