Open offtherailz opened 5 years ago
Both OpenLayers and leaflet allow customizing images loading by extending existing layers, so we could create our own extensions of the impacted layers (WMS and tiled WMS, eventually WMTS ones also) to use custom loaders. The custom loaders could use axios to load images through XHR, so that we can also take advantage of existing interceptors, eventually. Using XHR we can add all the headers we need. We need to check if this has any secondary issue and if we should enable/use custom loaders only when needed, switching back to default ones in other cases. For saving credentials: we can think of temporarily storing them on localStorage as a cache to avoid asking the user credentials each time he loads the page again.
The prompting "once per service" (and not "per layer") is almost essential. All secured (Dutch) services I use have a password policy where account get blocked after 5 wrong tries. That would easily happen if the check was on a per layer base.
Description
Actually the services that require a sort of authentication different from auth-key system can not be added to MapStore Maps. Also feasibility of this task have to be investigated.
Here a draft of the required tasks
Authentication: Basic ...
to the request of the images (some libraries useimg
tags instead of ajax, so this may be not feasable).A good strategy to avoid credentials saving may be to store in the state temporary access rules to the services, appended to the configured ones, if they exists (e.g. auth-key rules). This should guarantee the rules are applied every time the user access to that service, from ajax or image requests, and also have to have a local list of credentials inserted.