Obtaining map data through a proxy server with authentication (class "Tiles")

Nov 20, 2014 at 6:48 AM
Hi all!
Unable to load the map through the proxy server. My proxy server uses basic authentication. In the class "Tiles" is not possible to directly specify the user name and password. And in the process of work, the dialogue for their input of password does not appear. Anybody successfully loads the map through proxy with authentication?
Nov 23, 2014 at 11:07 AM
I've asked this to Sergei, he's the lead C++ developer of this project and he implemented the Tiles mechanism.
Nov 24, 2014 at 10:49 AM
There is no way to do it indeed, which is quite deplorable. I've just made some quick fix - Tiles.SetProxyAuthorization method. It uses BASIC authorization scheme. Http client will use provided credentials only if initial request without credentials returned 401 or 407. Presumably this will decrease performance, but It's the standard behavior of AtlHttpClient (http://msdn.microsoft.com/en-us/library/7shxzbwb(v=vs.80).aspx ). I didn't test the method with actual proxy so can't be sure that implementation is correct, apart from the fact that it doesn't break regular loading. If you have further ideas on how to improve this, please let us know. @Paul, I would much appreciate if you don't use the 'lead' word.
Jan 16, 2015 at 4:55 AM
Authorization on the proxy I have not earned. Perhaps there is a problem in the transfer of credentials in the class "BaseProvider". I wrote that transmits the program when requested the map. Authorization string in request header is changed and does not match to expected string.

Request 1: "Proxy-Authorization: Basic eAEUAVg6\r\n"
Request 2: "Proxy-Authorization: Basic GAIUAVg6\r\n"
Request 3: "Proxy-Authorization: Basic +AMUAVg6\r\n"
Another HTTP client:
Request 1: "Proxy-Authorization: Basic bWVsbmlrOjIwMDEz\r\n"
Request 2: "Proxy-Authorization: Basic bWVsbmlrOjIwMDEz\r\n"
Request 3: "Proxy-Authorization: Basic bWVsbmlrOjIwMDEz\r\n"
I compared the code MapWinGis and HttpClient Sample (HttpClient Sample) and found small differences:

CBasicAuthObject auth;
TilesAuthentication info(_proxyUsername, _proxyPassword, _proxyDomain);
httpClient.AddAuthObj("BASIC", &auth, &info);
HttpClient Sample:
CSampleBasicAuth basicAuth;
 client->AddAuthObj( _T("basic"), &basicAuth, &basicAuth );
In the second case the function is passed the same parameters.
Jan 16, 2015 at 6:38 AM
Thanks for the research. In the sample authentication object implements both interfaces:
class CSampleBasicAuth : public CBasicAuthObject, public IAuthInfo
While I use 2 different objects. I'll make changes accordingly. Most likely we shall release an installer with the fix to test for you.
Jan 16, 2015 at 4:05 PM
I've committed the changes: https://mapwingis.codeplex.com/SourceControl/changeset/75460. This time I tested it with CCProxy. Seems to be working. Details:
  • SetSilentLogonOk is set to true for HTTP client, otherwise its behavior depends on IE security settings (Security settings -> User authentication -> Logon);
  • a change is made in ATL HTTP source to force it reopen connection when no Connection header is returned by server (originally after 407 status it reconnected only if "Connection: close" was returned);
  • improved error reporting, so that both authentication errors and socket errors will be reported to application callback.
  • in theory NTML authentication scheme should be working as well, but I have no way to test it. It can be activated with Tiles.ProxyAuthenticationScheme = asNtlm;
  • Tiles.SetProxyAuthorization is renamed to SetProxyAuthentication;
We shall release an updated version of installer for testing soon.
Jan 28, 2015 at 6:29 AM
I've published a new installer with the fix mentioned by Sergei.
Get it at https://mapwingis.codeplex.com/releases/view/541892


Marked as answer by pmeems on 1/27/2015 at 11:29 PM
Sep 8, 2015 at 1:10 PM
Hi All,

Just to give my update on this as I hit the same problem.

I have tried quite a few things in my C# clinet but cannot get the tiles work through my company`s proxy.
            axMap1.TileProvider = MapWinGIS.tkTileProvider.OpenStreetMap;
            axMap1.GrabProjectionFromData = true;
            axMap1.Tiles.ProxyAuthenticationScheme = MapWinGIS.tkProxyAuthentication.asNtlm;
            axMap1.Tiles.SetProxy("http://PROXY.ABC.com", 8080);
            axMap1.Tiles.SetProxyAuthentication("XXXX", "******", "XXX");
I tuned on Fiddler, nothing happend. The same application works at my home.

If anyone has managed to get map tiles working through a proxy, could you please shed some lights?

thanks very much!