如何在Mule中公开安全的休息/肥皂服务,需要最好和最简单的方法

时间:2015-07-08 05:36:38

标签: mule mule-studio mule-component

在我的流程中,我有很多HTTP Rest API调用,我使用了密钥存储(如下所示),这对内部api调用很好。现在我需要向外部api公开rest / soap服务。这是保护mule api的简单而最好的方法。我正在使用Mule 3.5.1版本。

<https:connector name="HTTP_HTTPS" doc:name="HTTP-HTTPS"
    cookieSpec="netscape" receiveBacklog="0" receiveBufferSize="0"
    sendBufferSize="0" socketSoLinger="0" validateConnections="false"
    clientSoTimeout="10000" serverSoTimeout="10000" enableCookies="true">
    <https:tls-key-store path="cer/check.jks"
        keyPassword="abc" storePassword="abc" />
</https:connector>

 <flow name="service" doc:name="service">
    <https:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8085" doc:name="HTTP" connector-ref="HTTP_HTTPS" responseTransformer-refs="ReponseProperty"/>
    <byte-array-to-string-transformer doc:name="Byte Array to String"/>
    <logger message="***Invoke****#[payload]" level="INFO" doc:name="Logger"/>
 <jersey:resources doc:name="REST">
     <component class="com.services.CallImpl"/>
     <jersey:exception-mapper class="com.util.JerseyExceptionMapper"/>
</jersey:resources> 
<byte-array-to-string-transformer doc:name="Byte Array to String"/>

所以外部api调用,不应该干扰其他mule服务。 提前谢谢。

1 个答案:

答案 0 :(得分:1)

如果您想要简单的方法,基本身份验证就是非常简单的,但它基于传输层,但实现起来很简单

参考: - http://confluex.com/blog/http-inbound-endpoint-basic-authentication/

您还可以使用 oauth 2.0 保护您的服务,以便在客户端可以访问您的其他服务之前验证 令牌 参考: - https://developer.mulesoft.com/docs/display/current/Creating+an+OAuth+2.0a+Web+Service+Provider  和 http://ricston.com/blog/oauth-server-mule/
您也可以参考: - https://developer.mulesoft.com/docs/display/current/Mule+STS+OAuth+2.0a+Example+Application

您的Mule api中的其他选项是 JWT (JSON Web令牌),您需要生成令牌并验证它以访问您的服务..

参考: - http://jwt.io/

但是在这里你需要做很多Java编码来生成令牌并验证它

相关问题