Mule-ESB与基本身份验证

Mule-ESB与基本身份验证,mule,basic-authentication,Mule,Basic Authentication,我编写了一个接受JSON的流,现在我想添加http身份验证。我想接受HTTP基本身份验证uid和pw 因此,我首先从Hellow World计划开始,如下所示: <?xml version="1.0" encoding="UTF-8"?> <mule version="EE-3.5.0" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:core="http://www.mulesoft.org/schema/mule

我编写了一个接受JSON的流,现在我想添加http身份验证。我想接受HTTP基本身份验证uid和pw

因此,我首先从Hellow World计划开始,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<mule version="EE-3.5.0" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
    <flow doc:name="HelloWorldFlow1" name="HelloWorldFlow1">
        <http:inbound-endpoint doc:description="This endpoint receives an HTTP message." doc:name="HTTP" exchange-pattern="request-response" host="localhost" port="8081"/>
        <set-payload doc:description="This processor sets the payload of the message to the string 'Hello World'." doc:name="Set Payload" value="Hello World"/>
    </flow>
</mule>
这是可行的,因为在theflow中没有配置基本身份验证,所以它会忽略我在curl命令中发送的“-uuid:pw”

现在,我对流程进行如下更改(我在GUI的“Http设置->用户”字段中输入'uid',在“Http搜索->密码”字段中输入'pw'

<?xml version="1.0" encoding="UTF-8"?>
<mule version="EE-3.5.0" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
    <flow doc:name="HelloWorldFlow1" name="HelloWorldFlow1">
        <http:inbound-endpoint doc:description="This endpoint receives an HTTP message." doc:name="HTTP" exchange-pattern="request-response" host="localhost" port="8081" password="pw" user="uid"/>
        <set-payload doc:description="This processor sets the payload of the message to the string 'Hello World'." doc:name="Set Payload" value="Hello World"/>
    </flow>
</mule>
我已经多次这样做了,但我得到了同样的回应

有没有其他我应该设定的领域?关于如何解决这个问题有什么想法


谢谢

用户和密码属性在入站HTTP端点上无效,它们只在出站HTTP端点上有效


Mule使用Spring安全性进行身份验证。这在用户指南中有详细说明:,包括一个需要放入http入站端点的
http安全过滤器的示例。

我现在正试图实现Spring解决方案,但想知道为什么用户名和密码只在出站http上工作。这意味着什么它正在为服务器提供uid和pw,并将响应发送到(这似乎不太可能)?出站HTTP端点上的
用户名
密码
属性用于在Mule连接到的远程HTTP服务器上执行HTTP基本身份验证。入站身份验证通常涉及多个用户/PW,有时涉及各种安全领域。因此,需要在组件外部进行设置。
<?xml version="1.0" encoding="UTF-8"?>
<mule version="EE-3.5.0" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
    <flow doc:name="HelloWorldFlow1" name="HelloWorldFlow1">
        <http:inbound-endpoint doc:description="This endpoint receives an HTTP message." doc:name="HTTP" exchange-pattern="request-response" host="localhost" port="8081" password="pw" user="uid"/>
        <set-payload doc:description="This processor sets the payload of the message to the string 'Hello World'." doc:name="Set Payload" value="Hello World"/>
    </flow>
</mule>
C:\curl>curl -H "Content-Type: application/json" -u uida:pw -d {"first":"Steven"
} http://localhost:8081
Cannot bind to address "http://127.0.0.1:8081/" No component registered on that
endpoint