Fix #10966 basic auth for services#11067
Conversation
# This is the 1st commit message: Fix geosolutions-it#10966 basic auth for services # This is the commit message #2: Wip
web/client/actions/layers.js
Outdated
| options | ||
| }; | ||
| } | ||
| export function refreshSecurityLayers() { |
There was a problem hiding this comment.
Could you add a comment or jsdoc to explain this action?
| /** | ||
| * set status to show modal for inserting credentials | ||
| * @param {boolean} status | ||
| */ | ||
| export const setShowModalStatus = (status) => { | ||
| return { | ||
| status, | ||
| type: SET_SHOW_MODAL_STATUS | ||
| }; | ||
| }; | ||
| /** | ||
| * set protected services to request to provide username and password | ||
| * @param {object[]} protectedServices | ||
| */ | ||
| export const setProtectedServices = (protectedServices) => { | ||
| return { | ||
| protectedServices, | ||
| type: SET_PROTECTED_SERVICES | ||
| }; | ||
| }; |
There was a problem hiding this comment.
These two actions seems specific for the SecurityPopup plugin but they are inside the security actions.
There was a problem hiding this comment.
i did not want to create a securityPopop folder for just these actions but since the plugin is about security it might be good to have theme here
| url: head(getURLs(isArray(options.url) ? options.url : [options.url], queryParametersString)), | ||
| proxy: proxy && new WMTSProxy(proxy) || new NoProxy() | ||
| proxy: proxy && new WMTSProxy(proxy) || new NoProxy(), | ||
| ...(headers) |
There was a problem hiding this comment.
Looking at the doc, headers should be an object not spread inside the Cesium.Resource class, could you double check if it's working?
|
|
||
| import {optionsToVendorParams} from '../../../../utils/VendorParamsUtils'; | ||
| import {addAuthenticationToSLD, addAuthenticationParameter, getAuthenticationHeaders} from '../../../../utils/SecurityUtils'; | ||
| import {/* getCredentials, */addAuthenticationToSLD, addAuthenticationParameter, getAuthenticationHeaders} from '../../../../utils/SecurityUtils'; |
There was a problem hiding this comment.
please remove the commented method
| export const setCredentialsAction = (protectedService, creds) => { | ||
| if (creds && protectedService.protectedId) { | ||
| setCredentials(protectedService.protectedId, { | ||
| ...creds, | ||
| url: protectedService.url | ||
| }); | ||
| } | ||
| return { | ||
| protectedService, | ||
| type: SET_CREDENTIALS | ||
| }; | ||
| }; |
There was a problem hiding this comment.
Not sure if it would be better to have the setCredentials side effect inside the reducer instead of the action
Co-authored-by: stefano bovio <stefano.bovio@geosolutionsgroup.com>
Co-authored-by: stefano bovio <stefano.bovio@geosolutionsgroup.com>
) * # This is a combination of 2 commits. Fix geosolutions-it#10966 basic auth for services Wip * Fix geosolutions-it#10966 basic auth for services * update config * fix jsdoc * fix jsdoc * fix tests * update review * clean up * fix tests * Update web/client/plugins/MetadataExplorer.jsx Co-authored-by: stefano bovio <stefano.bovio@geosolutionsgroup.com> * Update web/client/plugins/MetadataExplorer.jsx Co-authored-by: stefano bovio <stefano.bovio@geosolutionsgroup.com> --------- Co-authored-by: stefano bovio <stefano.bovio@geosolutionsgroup.com>
|
@MV88 1.mp42_ when I set the credentials and click on the Confirm button, the credentials popup does not close automatically. You have to click on Cancel 2.mp43_ Once the Authentication button turns green, when you open it, the username and password are not visible 3.mp4 |
@tdipisa do we have to check this before adding the layer? from getCapabilities id no not know if a layer is protected via basic auth, the admin should know it, otherwise we have to try to make a request per each record to see if the getMap will fail or not without basic auth, but i',m not sure if we want this now or in the future
checking probably a quick issue
this is because credentials are not persisted in the application, but only if a service / layers is protected using ids |
Status after last sync reported in #10966 (comment) |
Description
A new SecurityPopup plugin has been added to handle secured services using basic auth.
main features
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
What is the current behavior?
Fix #10966
What is the new behavior?
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information
This is how a secured service look like

For tester
We created a set of rules using GeoFence in gs-stable for testing. i have created a layer "linea costa basic" that has access using some credentials, can can ask in pvt. so you can try using it

the idea is that this will only work if a protected service is configured, and failing if not. This will be valid for many layer types in ol and cesium
with cesium test WMS and WMTS, TileProvider
with openlayers test WMS, WMTS, WFS, ARCGIS, TMS, TileProvider, COG