【问题标题】:WSO2 EI and WSO2 Developer - Setup an ESB Proxy with http basic authenticationWSO2 EI 和 WSO2 Developer - 使用 http 基本身份验证设置 ESB 代理
【发布时间】:2019-02-19 15:19:12
【问题描述】:

我正在使用 WSO2 EI 6.3.0 和 WSO2 Developer Studio 3.8.0。
我正在使用 ESB 项目和其中的代理服务。

代理服务是一个简单的直通服务; 它接收来自 webapp 的请求并将其转发给 Soap Web Service,从 WS 获取响应并给出 它返回到网络应用程序。

我按照这个教程实现了这个配置:
https://youtu.be/3OsuGhEMQgc

设置非常简单,一切正常,直到我发现 端点具有 http 基本身份验证的 Web 服务。

感谢这篇文章,我让它工作了:
https://medium.com/@Jenananthan/wso2-esb-how-to-invoke-basic-auth-protected-endpoint-service-5bcdd8290cb4

下面是描述代理服务的xml:

<?xml version="1.0" encoding="UTF-8"?>
<proxy name="ProxyWithBasicAuth" startOnLoad="true" trace="disable" transports="https" xmlns="http://ws.apache.org/ns/synapse">
    <target>
        <endpoint name="endpoint_urn_uuid_xxxxxxxx-yyyy-zzzz-1111-234567892345">
            <address trace="disable" uri="https://here.goes.the.uri.of.the.ws.endpoint"/>
        </endpoint>
        <inSequence>
            <property value="this_is_the_username" name="username" scope="default" type="STRING"/>
            <property value="this_is_the_password" name="password" scope="default" type="STRING"/>
            <property expression="fn:concat($ctx:username,':',$ctx:password)" name="credentials" scope="default" type="STRING"/>
            <property expression="fn:concat('Basic ', base64Encode($ctx:credentials))" name="Authorization" scope="transport" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
        <faultSequence/>
    </target>
</proxy>

所以,这个配置(xml 文件)正在工作,但我写了所有 无需使用 gui 的任何可视或拖放元素即可启用基本身份验证的部分。

我的问题是:
1) 这是在代理服务上设置基本身份验证的正确方法吗?
2) 是否存在任何允许直观地进行此设置的 gui(拖放)元素?

注意:我不需要在 “客户”和 ESB 代理服务;这个问题是关于基本的 ESB 代理服务和“外部”Web 服务之间的身份验证。

【问题讨论】:

  • 你能帮忙让它工作吗?我复制了你的代理,但我不知道如何测试它?无论是否具有基本身份验证,它都可以正常工作

标签: wso2 wso2esb basic-authentication wso2ei wso2developerstudio


【解决方案1】:

你所做的是正确的。要调用使用 Basic Auth 保护的服务,我们只需将 Authorization 标头设置为消息。您可以使用 Header Mediator[1] 或 Property mediator(您已经使用过)来执行此操作。没有专门为设置授权标头而设计的特殊调解器(或工具中的 GUI 元素)。

顺便说一句,您可以考虑将密码存储在安全保险库[2] 中,而不是在 Synapse 配置中以纯文本形式保存密码。

[1]https://docs.wso2.com/display/EI640/Header+Mediator [2]https://docs.wso2.com/display/EI640/Working+with+Passwords+in+the+ESB+profile

【讨论】:

  • 第二个安全保险库部分,也是我首先想到的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-07-08
  • 1970-01-01
  • 1970-01-01
  • 2015-10-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多