0

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

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

我是 WSO2 ESB 和数据服务服务器的新手,因此不胜感激。

4

1 回答 1

0

我最终在 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);
于 2012-04-19T17:06:18.677 回答