WSO2 EI和WSO2 Developer - 使用http基本身份验证设置ESB代理

问题描述 投票:1回答:1

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

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

我按照本教程实现了这个配置: 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个回答
3
投票

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

顺便说一句,您可以考虑将密码存储在secure-vault [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

© www.soinside.com 2019 - 2024. All rights reserved.