Implementing HTTPS with Mule ESB

本文介绍如何使用 Mule ESB 3.1 版本实现 HTTPS 通信,包括基本 SSL 设置及双向认证配置。通过定义 HTTPS 连接器并应用于进出站端点,可以轻松增强系统的安全性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Implementing HTTPS with Mule ESB

At one of my clients we use the Mule ESB (3.1) to communicate with the outside world. A big difference compared with having Mule running inside the company network is the security. One of the steps to make the communication more secure is to use HTTPS instead of HTTP. Other measures we took (signing the outgoing and validating the incoming SOAP requests) will be handled in another post.

Luckily with a tool as Mule ESB this is not a big issue. Simply define a HTTPS connector in your config and refer to that instead of the HTTP connector in your HTTP endpoints. The connector definition looks like this: 

<https:connector name="httpsConnector" clientSoTimeout="0" serverSoTimeout="0">
       <https:tls-client path="${my.ssl.keystore}" storePassword="${my.ssl.keystore.password}"/>
       <https:tls-key-store path="${my.ssl.keystore}"  storePassword="${my.ssl.keystore.password}" keyPassword="${my.ssl.keystore.password}"/>
       <https:tls-server path="${my.ssl.keystore}" storePassword="${my.ssl.keystore.password}"/>
   </https:connector>

And your endpoints will become something like:

<flow name="my-secure-flow">
        <https:inbound-endpoint address="${my.incoming.url}" connector-ref="httpsConnector">
            ...
        </https:inbound-endpoint>
        <https:outbound-endpoint address="${my.internal.url}" connector-ref="httpsConnector">
            ...
        </https:outbound-endpoint>
    </flow>

By the way, all ‘${…}’ are translated to real values at deploy time. There is a nice article how to accomplish this.

However this is just the basic SSL setup. In our case the customer wanted to take it a step further and implement the mutual authentication which is explained nicely here . The question is if this is also doable with the Mule ESB. Although it took me a while to find out I ended up here in the Mule forum and it seems quite easy to accomplish. Just add the property requireClientAuthentication=”true” to the ‘tls-server’ and it is should be fixed.

<https:connector name="httpsConnector" clientSoTimeout="0" serverSoTimeout="0">
       <https:tls-client path="${my.ssl.keystore}" storePassword="${my.ssl.keystore.password}"/>
       <https:tls-key-store path="${my.ssl.keystore}"  storePassword="${my.ssl.keystore.password}" keyPassword="${my.ssl.keystore.password}"/>
       <https:tls-server path="${my.ssl.keystore}" storePassword="${my.ssl.keystore.password}" requireClientAuthentication="true"/>
   </https:connector>

We will test this of course but so far it is looking good.

Published at DZone with permission of  Pascal Alma , author and DZone MVB. (  source ) 

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值