首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法将“授权”报头发送到端点- HTTP模块- Mulesoft 3.9

无法将“授权”报头发送到端点- HTTP模块- Mulesoft 3.9
EN

Stack Overflow用户
提问于 2019-07-04 19:08:34
回答 2查看 991关注 0票数 0

我试图从骡子流中调用API Rest。这个API有一个基本的auth协议,所以我需要发送报头"Authorization: basic“。我遇到的问题是,在Anypoint Studio上,当我计算HTTP请求时,我在身份验证选项卡上没有获得Basic选项,我只看到NTLM。

  • 我已经尝试手动设置标题,但是它被忽略了。
  • 已经尝试包括以下内容:

在http:上,它也不起作用。

这是Mule配置:

代码语言:javascript
复制
< http:listener-config name="Gateway" host="localhost" port="8281" basePath="/base" doc:name="HTTP Listener Configuration"/>

< http:request-config name="OFSC" host="api.etadirect.com" basePath="/rest/ofscCore/v1" doc:name="HTTP Request Configuration" port="443" protocol="HTTPS">
    < http:basic-authentication username="${ofsc.clientId}@${ofsc.instance}" password="${ofsc.clientKey}"/>
< /http:request-config>

< spring:beans>
    < spring:bean id="Bean" name="BasicAuthEncode" class="tools.BasicAuthEncode" />
< /spring:beans>

< context:property-placeholder location="env.properties"/>   

<flow name="TestFlow">
    <http:listener config-ref="Gateway" path="/test" doc:name="HTTP">
        <http:response-builder disablePropertiesAsHeaders="true"/>
        <http:error-response-builder disablePropertiesAsHeaders="true"/>
    </http:listener>
    <invoke object-ref="BasicAuthEncode" method="encodeCredentials" doc:name="LPM" methodArgumentTypes="java.lang.String" methodArguments="${ofsc.clientId}@${ofsc.instance}:${ofsc.clientKey}" name="LPM2"/>
    <set-variable variableName="credentials" value="Basic #[message.payloadAs(java.lang.String)]" doc:name="Creds"/>
    <http:request config-ref="OFSC" path="/activities/3818" method="GET" doc:name="HTTP">
        <http:request-builder>
            <http:header headerName="Content-Type" value="application/json"/>
        </http:request-builder>
        <http:success-status-code-validator values="200,400,401,404,403"/>
    </http:request>
    <logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
</flow>

我可能做错了什么,但找不到答案。希望你们能帮我

谢谢

EN

回答 2

Stack Overflow用户

发布于 2019-07-05 16:07:10

问题在我的财产档案里。

用引号包装的值和base64编码给了我错误的字符串。

票数 0
EN

Stack Overflow用户

发布于 2022-12-01 15:41:39

取消选中http配置中的“启用cookie”解决了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56893245

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档