我的synapse提取配置如下所示:
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
<then>
<property name="api.ut.backendRequestTime"
expression="get-property('SYSTEM_TIME')"/>
<property name="password"
expression="wso2:vault-lookup('PayAdmin-- ZenoAPI51.0')"/>
<property name="unpw"
expression="fn:concat('user',':',get-property('password'))"/>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode(get-property('unpw')))"
scope="transport"/>
<send>
<endpoint name="PayAdmin--ZenoAPI5_APIproductionEndpoint_0">
<http uri-template="http://localhost:8080/payment/{uri.var.name}"/>
</endpoint>
</send>
</then>
我想知道的是:
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: Bearer 2e13c9b3c8717f43d093cfc7c63994bb" -d "{}" http://<IP address of APIM Server>:8280/Zeno1/1.0.0/payment/name
这个curl只能接受bearer token但是如何在curl中传递user / pwd for API和user / pwd for backend
答案 0 :(得分:1)
关于你的第二个问题: 对于后端的基本身份验证,您可以在步骤实施 - &gt;中在发布服务器中配置常规密码。显示更多选项 - &gt;端点安全方案:设置为安全并提供凭据 (见:https://docs.wso2.com/display/AM1100/Basic+Auth)
如果必须提供用户特定凭据,则用户应设置&#34;身份验证:基本base64(用户名:密码)&#34;在HTTP标头中,标头将传递给后端。
答案 1 :(得分:0)
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: **Basic** **[base64encode(username:password)]**" -d "{}" http://<IP address of APIM Server>:8280/Zeno1/1.0.0/payment/name
[base64encode(username:password)]将其替换为base64编码字符串 “用户名:密码”