gpt4 book ai didi

java - Http.outboundGateway 上的 Spring Integration DSL OAuth

转载 作者:行者123 更新时间:2023-12-02 09:20:30 41 4
gpt4 key购买 nike

我对 Spring-Integration 有点陌生,一直在尝试 POC 一些简单的任务。我从未接触过 OAuth,并且需要 OAuth 的休息服务,我希望有人可以向我展示一个通过 Java DSL 使用 OAuth 的示例。我目前正在从 Rabbit 获取消息并转换为 JAVA POJO,然后将其发送到新 channel 以发布到 Rest 服务,但我需要首先针对服务器进行身份验证。正如我所说,刚接触 SI 和 OAuth,正在寻找一些建议。我似乎在使用 OAuth 的 DSL 上找不到任何内容


@Bean
public IntegrationFlow amqpInboundGateway(ConnectionFactory connectionFactory, @Value("${rabbitmq.queue}") String queue) {
return IntegrationFlows.from(Amqp.inboundGateway(connectionFactory, queue))
.transform(Transformers.toJson())
.transform(Transformers.fromJson(Call.class))
.log(message -> message.getPayload())
.channel("rabbitOutput")
.get();
}

@Bean
public IntegrationFlow httpPostAtms( @Value("${alemba.incident.get}") String uri) {

return IntegrationFlows.from("rabbitOutput")
.handle(Http.outboundGateway(uri)
.httpMethod(HttpMethod.POST)
.extractPayload(true))
.transform(Transformers.toJson())
.log()
.get();

}

最佳答案

我不熟悉 OAuth,但是 Http.outboundGateway() 可以使用外部 RestTemplate 进行配置,可以通过任何可能的方式进行自定义。请了解有关 Spring Security 中 OAuth 的更多信息: https://docs.spring.io/spring-security/site/docs/5.2.1.RELEASE/reference/htmlsingle/#oauth2 。 Spring Integration 中对此无能为力:完全不是这个项目的责任

关于java - Http.outboundGateway 上的 Spring Integration DSL OAuth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58728931/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com