Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10506 Adding possibility to fetch legends images using Bearer token #10507

Merged

Conversation

MV88
Copy link
Contributor

@MV88 MV88 commented Aug 9, 2024

Description

adding possibility to request images legend using bearer token

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

What is the current behavior?

Fix #10506

What is the new behavior?

now if the legend url needs to use a Bearer token it switches to a SecureImage component that fetches the token from state, so this will work only if the user is logged in (because the legends are behind a secured geoserver, and authentication is needed)
otherwise it will show legend not available

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

I also remove the line
addAuthenticationParameter(url, query);

because it was doing nothing placed there (returning a value not used)

@MV88 MV88 added this to the 2024.02.00 milestone Aug 9, 2024
@MV88 MV88 requested a review from allyoucanmap August 9, 2024 08:59
@MV88 MV88 self-assigned this Aug 9, 2024
web/client/plugins/TOC/components/SecureImage.jsx Outdated Show resolved Hide resolved
web/client/plugins/TOC/components/SecureImage.jsx Outdated Show resolved Hide resolved
web/client/plugins/TOC/components/SecureImage.jsx Outdated Show resolved Hide resolved
web/client/plugins/TOC/components/Legend.jsx Show resolved Hide resolved
web/client/plugins/TOC/components/Legend.jsx Outdated Show resolved Hide resolved
* removed async await and fetch
* changed way of using token in case of bearer auth
@MV88 MV88 requested a review from allyoucanmap August 13, 2024 13:36
@tdipisa
Copy link
Member

tdipisa commented Aug 19, 2024

@allyoucanmap can you please review this PR again on the light of latest changes? Can you approve?

@allyoucanmap allyoucanmap merged commit 7b1e9b4 into geosolutions-it:master Aug 19, 2024
6 checks passed
@allyoucanmap
Copy link
Contributor

@ElenaGallo please test this fix on DEV, thanks

@MV88
Copy link
Contributor Author

MV88 commented Aug 19, 2024

@ElenaGallo
in order to really test this we should need an instance with bearer token enabled a security token.

in our case you can simply test a layer that has legend that is visible and not broken by this pr

@tdipisa
Copy link
Member

tdipisa commented Aug 19, 2024

Thank you @MV88

@ElenaGallo

in order to really test this we should need an instance with bearer token enabled a security token.

This test will be performed by me and @MV88 in a dedicated infrastructure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GetLegendGraphic does not manage Bearer token
4 participants