ThinkGeo.com    |     Documentation    |     Premium Support

WmsRasterTileSource/WmtsRasterTileSource and authentication

Hi,

I have been checking those new classes for WMS and WMTS for GPU rendering.

In our case we need to also support authentication for these services either with username/pwd or API key. Currently we have done it by hooking to layers SendingHttpRequest event and modifying HttpRequestMessage if needed.

What is the way to achieve the same with WmsRasterTileSource/WmtsRasterTileSource ? At least I could not see any events which could hooked to modify outgoing request.

Br, Simo

Hi Simo,

It’s now added in 15.0.0-beta161, you can set it as following:

var source = new WmtsRasterTileSource(new Uri("https://.../wmts"));
source.SendingHttpRequest += (_, e) =>
    e.HttpRequestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);

Let me know if you see any issues.

Thanks,
Ben