【问题标题】:Passing Username and Password to a WSO2 ESB Proxy/endpoint将用户名和密码传递给 WSO2 ESB 代理/端点
【发布时间】:2014-10-23 19:55:42
【问题描述】:

我在 WSO2 ESB 中设置了一个直通代理服务,它连接到 WSO2 数据服务服务器服务。我想将访问此代理服务的权限仅限于我已定义的那些。如果我转到代理服务的 URL,我会收到一个用户/密码提示,如果我手动输入凭据,该提示会起作用,但我想对 URL 进行 GET 调用,所以我没有那个凭据提示。

如何设置代理/服务以通过 GET 调用通过身份验证?是否有一种“最佳实践”方式可以让我重复使用它?

我是 WSO2 ESB 和数据服务服务器的新手,因此非常感谢任何帮助。

【问题讨论】:

    标签: wso2 wso2esb


    【解决方案1】:

    我最终在 C# 中使用了它:

    WebRequest myRequest = WebRequest.Create("https://host.domain.com:8243/services/ProductsProxy.ProductsProxyHttpEndpoint/ProductID/123456");
    
    // Set 'Preauthenticate'  property to true.  Credentials will be sent with the request.
    myRequest.PreAuthenticate = true;
    
    string UserName = "myuser";
    string Password = "myPassword";
    
    // Create a New 'NetworkCredential' object.
    NetworkCredential networkCredential = new NetworkCredential(UserName, Password);
    
    // Associate the 'NetworkCredential' object with the 'WebRequest' object.
    myRequest.Credentials = networkCredential;
    
    // Set a timeout value
    myRequest.Timeout = 100;
    
    //Trust all certificates since I'm just doing dev and don't have a cert yet.
    System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-10
      • 1970-01-01
      • 1970-01-01
      • 2011-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多