Question

I have set up a pass through proxy service in WSO2 ESB which connects to a WSO2 Data Services Server service. I would like to restrict access to this proxy service to only those I have defined. If I go to the URL of the proxy service I get a user/pass prompt which works if I manually type the credentials, but I want to make a GET call to the URL so I don't have that credential prompt.

How can I set up the proxy/service to pass the authentication through a GET call? Is there a "best practice" way that I can do it so I can reuse it?

I'm new to WSO2 ESB and Data Services Server so any help is appreciated.

Was it helpful?

Solution

I ended up using this in 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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top