geosolutions-it / MapStore2

The solution to create and share maps, dashboards, geostories with 3D support on the web. And it is open-source too!
https://mapstore.geosolutionsgroup.com/
Other
512 stars 399 forks source link

Support for Basic authentication for Layers and catalog Services #3380

Open offtherailz opened 5 years ago

offtherailz commented 5 years ago

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

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.

mbarto commented 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.

gisnederland commented 4 years ago

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.