繁体   English   中英

WSO2 ESB安全代理端点

[英]WSO2 ESB Secured Proxy Endpoint

我将ESB与许多不同的代理一起使用。

其中之一是将消息发送到其他代理端点。 所有代理都在ESB中。

目前,这些Endpoint Proxies尚未得到保护。 我喜欢使用scenario1作为它们的安全性。 但是我如何将消息发送到那些端点。 这意味着:如何在代理配置中添加带有用户名和密码的安全标头,以便可以使用用户“ admin”和密码“ admin”进行身份验证?

据我了解,您需要保护代理并将其转发到不安全的后端服务。

为此,您可以尝试从WSO2 ESB管理控制台执行以下步骤。 我在WSO2 ESB 4.7.0中尝试过

  1. 添加直通代理服务
  2. 从服务仪表板查看代理。
  3. 单击该服务的“安全性”。
  4. 为“启用安全性”选择“是”。
  5. 选择“ UsernameToken”,然后单击“下一步”。 您提到的场景1。 这将使用带有用户名令牌的WS-Security标准。
  6. 您可以在此处选择“管理员”组,然后单击“完成”

现在,将为您的服务启用安全性。

代理服务现在需要身份验证,您现在可以使用“ admin”用户。 (或您添加的任何用户)。

如果使用Java客户端,则在启用Rampart模块的情况下使用Axis2可能会更容易。 有很多这样的例子。

请参阅以下链接。

http://blog.facilelogin.com/2008/11/security-policy-with-rampart.html (这有一个简单的客户端)

http://blog.thilinamb.com/2009/08/securing-web-service-with-username.html

我使用SoapUI对此进行了测试。 您可以从请求属性中传递用户名和密码。

SoapUI请求属性

您的请求将类似于以下内容。

Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "POST /services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpsSoap12Endpoint HTTP/1.1[\r][\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "Accept-Encoding: gzip,deflate[\r][\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "Content-Type: application/soap+xml;charset=UTF-8;action="urn:getQuote"[\r][\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "Content-Length: 1195[\r][\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "Host: isurup-ThinkPad-T530:8243[\r][\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "[\r][\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "<soap:Envelope xmlns:ser="http://services.samples" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://services.samples/xsd">[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "   <soap:Header><wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsu:Timestamp wsu:Id="TS-63"><wsu:Created>2013-08-20T19:45:32Z</wsu:Created><wsu:Expires>2013-08-20T21:08:52Z</wsu:Expires></wsu:Timestamp><wsse:UsernameToken wsu:Id="UsernameToken-62"><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">WG8iV7vik8QqZkzlaIabWg==</wsse:Nonce><wsu:Created>2013-08-20T19:45:32.861Z</wsu:Created></wsse:UsernameToken></wsse:Security></soap:Header>[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "   <soap:Body>[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "      <ser:getQuote>[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "         <ser:request>[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "            <xsd:symbol>WSO2</xsd:symbol>[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "         </ser:request>[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "      </ser:getQuote>[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "   </soap:Body>[\n]"
Wed Aug 21 01:15:32 IST 2013:DEBUG:>> "</soap:Envelope>"

更新如果还保护了后端服务,则可以参考以下博客文章。

http://soasecurity.org/2012/11/05/how-to-invoke-secured-backend-service-using-wso2-esb/

在呼叫代理服务中,您可以按如下方式配置属性,

<property name="Authorization"
               expression="fn:concat('Basic ', base64Encode('admin:admin'))"
               scope="transport"
               type="STRING"/>

这样,将在对被调用代理服务的请求中设置basicAuth标头。 希望这可以帮助。

在您的方案中,您需要使用代理服务调用受保护的后端(另一个代理服务)。 为此,您将需要编写安全策略。 请参阅[1]博客文章。

[1] http://soasecurity.org/2012/11/05/how-to-invoke-secured-backend-service-using-wso2-esb/

您可以简单地使用curl来调用安全的代理服务,如下所示。

curl -k --basic -u admin:admin https://localhost:8243/services/PoxSecurityProxy.POXSecurityProxyHttpsSoap11Endpoint/echoString?in=Chanaka

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM