本文介绍了如何在 Camel(最好是 Blueprint)的 CXF 端点 (SOAP) 中实现 OAuth 流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过 camel-cxf 端点处理 SOAP 网络服务.如何实施 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 流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!