2012-04-18 101 views
0

我已經在連接到WSO2數據服務服務器服務的WSO2 ESB中設置了通過代理服務。我想限制只有那些我已經定義的代理服務。如果我轉到代理服務的URL,那麼我會得到一個用戶/傳遞提示,如果我手動輸入憑據,它會起作用,但我想對該URL進行GET調用,所以我沒有該憑據提示。將用戶名和密碼傳遞給WSO2 ESB代理/端點

如何設置代理/服務以通過GET調用傳遞身份驗證?有沒有「最佳實踐」的方式,我可以做到這一點,所以我可以重用它?

我是新來WSO2 ESB和數據服務服務器,所以任何幫助表示讚賞。

回答

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); 
相關問題