WSO2 EI和WSO2 Developer-使用http基本身份验证设置ESB代理 [英] WSO2 EI and WSO2 Developer - Setup an ESB Proxy with http basic authentication
问题描述
我正在使用WSO2 EI 6.3.0和WSO2 Developer Studio 3.8.0.
我正在处理一个ESB项目和其中的代理服务.
I'm using WSO2 EI 6.3.0 and WSO2 Developer Studio 3.8.0.
I'm working with an ESB Project and a Proxy Service inside it.
代理服务是一种简单的传递服务; 它收到来自Webapp的请求,并将其转发到 Soap Web服务,从WS获得响应并给出 并返回到网络应用.
The Proxy service is a simple pass through service; it receives a request from a webapp and forward it to a Soap Web Service, gets the response from the WS and gives it back to the web app.
我在本教程之后意识到了这种配置:
https://youtu.be/3OsuGhEMQgc
I realized this configuration following this tutorial:
https://youtu.be/3OsuGhEMQgc
设置非常简单,一切正常,直到我发现 端点具有http基本身份验证的Web服务.
The setup is very simple, everything worked fine until I found a web service whose endpoint has http basic authentication.
多亏了这篇文章,我才得以成功实现:
https://medium .com/@ Jenananthan/wso2-esb-如何调用基本身份验证保护的端点服务-5bcdd8290cb4
I made it work thanks to this article:
https://medium.com/@Jenananthan/wso2-esb-how-to-invoke-basic-auth-protected-endpoint-service-5bcdd8290cb4
下面是描述代理服务的xml:
Here follows the xml that describes the proxy service:
<?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的任何可视元素或拖放元素的情况下,启用基本身份验证的部分.
So, this configuration (xml file) is working, but I wrote all the section that enables basic auth without using any visual or drag and drop element of the gui.
我的问题是:
1)这是在代理服务上设置基本身份验证的正确方法吗?
2)是否有任何gui(拖放)元素可以直观地进行此设置?
My questions are:
1) is this the right way to setup basic auth on a proxy service?
2) is there any gui (drag and drop) element that allows to do this setup visually?
注意:我之间无需进行基本身份验证 客户"和ESB代理服务;这个问题是关于基本的 ESB代理服务和外部" Web服务之间的身份验证.
Note: I do not need to struggle with basic authentication between "clients" and the ESB Proxy Service; this question is about basic authentication between ESB Proxy Service and an "external" web service.
推荐答案
您所做的正确.要调用受基本身份验证保护的服务,我们只需将授权标头设置为消息.您可以使用Header Mediator [1]或Property介体(已经使用过)来执行此操作.没有专门用于设置授权标头的特殊介体(或工具中的GUI元素).
What you have done is correct. To invoke a service secured with Basic Auth, we just have to set the Authorization header to the message. You could use Header Mediator[1] or the Property mediator (as you have already used) to do that. There is no special Mediator (or a GUI element in the Tool) specifically designed for setting the Authorization header.
顺便说一句,您可以考虑将密码存储在secure-vault [2]中,而不是在Synapse配置中以纯文本格式存储.
Btw, you could consider storing passwords in the secure-vault[2] rather than having it in plain text in the Synapse configuration.
[1] https://docs.wso2.com/display/EI640/Header + Mediator [2] https://docs.wso2 .com/display/EI640/Working + with + Passwords + in + the + ESB + profile
[1] https://docs.wso2.com/display/EI640/Header+Mediator [2] https://docs.wso2.com/display/EI640/Working+with+Passwords+in+the+ESB+profile
这篇关于WSO2 EI和WSO2 Developer-使用http基本身份验证设置ESB代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!