【发布时间】:2019-02-16 21:32:46
【问题描述】:
我想通过 camel-cxf 端点 处理 SOAP Web 服务。如何实现 OAuth 流程,最好在蓝图中实现?这是可配置的还是我必须自己实现?
【问题讨论】:
标签: oauth-2.0 apache-camel cxf jbossfuse blueprint-osgi
我想通过 camel-cxf 端点 处理 SOAP Web 服务。如何实现 OAuth 流程,最好在蓝图中实现?这是可配置的还是我必须自己实现?
【问题讨论】:
标签: oauth-2.0 apache-camel cxf jbossfuse blueprint-osgi
我在此找到了不错的 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>
【讨论】: