【问题标题】:How to Exposing secure rest/soap service in Mule, require best and simple approach如何在 Mule 中公开安全的 rest/soap 服务,需要最好和简单的方法
【发布时间】:2015-07-08 16:42:01
【问题描述】:

在我的流程中,我有许多 HTTP Rest API 调用,我使用了密钥库(如下所示),这对于内部 api 调用很好。现在我需要将 rest/soap 服务暴露给外部 api。这是保护 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 服务。 提前致谢。

【问题讨论】:

    标签: mule mule-studio mule-component


    【解决方案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+Providerhttp://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 Token),您需要在其中生成 Token 并对其进行验证以访问您的服务..

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

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

    【讨论】:

    • 谢谢(计划通过 1 或 2)。除了上面提供的这些。是否还有其他方法可以保护 Mule 提供的 API。寻找基于知识的,以便可以探索更多。
    • Mule 基本上为企业版提供 oauth 2.0,为社区版为 REST 服务提供基本身份验证......可能还有其他开箱即用的方法,Mule 支持或推荐..但这两种方法基本上都实现了以防在 Mule 中暴露 Rest
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-08
    • 2013-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-09
    相关资源
    最近更新 更多