Spring security 使用Spring集成和Oauth调用RESTWebService

Spring security 使用Spring集成和Oauth调用RESTWebService,spring-security,oauth,spring-integration,spring-security-oauth2,resttemplate,Spring Security,Oauth,Spring Integration,Spring Security Oauth2,Resttemplate,我的目标是使用出站网关执行对REST web服务的调用,此web服务需要另一个web服务提供的令牌。 我尝试过使用SpringOAuth,但没有任何运气,因为我不知道如何集成这两个框架 <int:chain input-channel="requestChannel"> <int-http:outbound-gateway url="https://webservice.url/..."

我的目标是使用出站网关执行对REST web服务的调用,此web服务需要另一个web服务提供的令牌。 我尝试过使用SpringOAuth,但没有任何运气,因为我不知道如何集成这两个框架

    <int:chain input-channel="requestChannel">
                <int-http:outbound-gateway
                url="https://webservice.url/..."
                http-method="GET" expected-response-type="java.lang.String"
                rest-template="restTemplate" />
                ... 
    </int:chain>

    <oauth:resource id="oauth1" client-id="admin"
        access-token-uri="https://token.priovider.url/..."
        client-secret="secret" client-authentication-scheme="header" type="password"
        scope="trust" password="mypassword" username="myusername" />

    <oauth:rest-template id="restTemplate" resource="oauth1" />
在调试过程中,我在以下行(OAuth2RestTemplate构造函数)中发现,“context”的值为“com.sun.jdi.InvocationException调用方法时发生。”:

public OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context)

我从未使用过OAuth,但您的配置对我来说似乎是合理的。你有什么问题?看起来怎么样?也许您还需要一个
restemplate
来覆盖OAuth的这个模板?最好像对qeustion进行
EDIT
那样。否则就无法从注释中读取。从另一端看,在类型为的对象上找不到属性或字段“request”与OAuth完全不相关。那是不一样的。请不要在问问题时混淆视听。你确定你的目标Web服务真正需要什么类型的令牌吗?也许它不期望OAuth令牌?您是否检查过spring集成是否真的使用了OAuth2RestTemplate而不是标准的RestTemplate?您好,andifalk,它使用的是OAuth2RestTemplate,我已经用更多细节更新了我的描述。我的Web服务需要的令牌类型是我前面提到的,它是由另一个Web服务通过传递用户名和密码提供的。我不确定我的解决方案中是否使用了正确的流或组件。谢谢。我从未使用过OAuth,但您的配置对我来说似乎是合理的。你有什么问题?看起来怎么样?也许您还需要一个
restemplate
来覆盖OAuth的这个模板?最好像对qeustion进行
EDIT
那样。否则就无法从注释中读取。从另一端看,在类型为的对象上找不到属性或字段“request”与OAuth完全不相关。那是不一样的。请不要在问问题时混淆视听。你确定你的目标Web服务真正需要什么类型的令牌吗?也许它不期望OAuth令牌?您是否检查过spring集成是否真的使用了OAuth2RestTemplate而不是标准的RestTemplate?您好,andifalk,它使用的是OAuth2RestTemplate,我已经用更多细节更新了我的描述。我的Web服务需要的令牌类型是我前面提到的,它是由另一个Web服务通过传递用户名和密码提供的。我不确定我的解决方案中是否使用了正确的流或组件。非常感谢。
public OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context)