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

Mutable http headers #1204

Closed

Conversation

srmncnk
Copy link
Contributor

@srmncnk srmncnk commented Oct 12, 2022

This PR improves setting custom http headers with each tile request in order to support an authentication layer for protected custom resources.

It solves two problems:

  • introduction of filters
  • enabling headers to change in time on iOS.

Filtering feature prevents the user from leaking protected headers to resources which are not protected (and controlled by someone else). It is an optional parameters and passing null will cause headers to be appended to each request, so functionality stays as is. Passing a filter will cause appending headers only to requests, which contain filter content in URLs. Passing an empty filter will cause that no headers are appended to requests.

Mutable headers is an iOS issue. Setting headers at startup works, but setting them the second time (e.g. when access token invalidates) does not work. The proposed solution involves swizzling and because of that extra documentation was added to make sure end-users understand the risks when using this approach. That's why it is opt-in.
An additional method for checking previously set headers state was added to allow easy checking, whether setting headers works, since swizzling can break with SDK update.

An example with a local server was added to illustrate the behaviour of setting http headers client side and handling them server side.

@srmncnk
Copy link
Contributor Author

srmncnk commented Oct 12, 2022

In order to make this work for web, https://github.com/andrea689/mapbox-gl-dart from @andrea689 would have to be corrected (more accurately, probably andrea689/mapbox-gl-dart#17 would have to be completed).

@srmncnk srmncnk had a problem deploying to ANDROID_CI_DOWNLOADS_TOKEN October 17, 2022 14:35 Failure
@srmncnk srmncnk had a problem deploying to ANDROID_CI_DOWNLOADS_TOKEN October 17, 2022 14:35 Failure
…mapbox-gl#1217)

* Backwards compatibility for delayed disposal in flutter 2.x

* Backwards compatible TextureAndroidViewController with support for size in create method

* Formatting cleanup

Co-authored-by: Simon Irmančnik <[email protected]>
@srmncnk
Copy link
Contributor Author

srmncnk commented Oct 26, 2022

Rebased to master.

@stale
Copy link

stale bot commented Dec 25, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 25, 2022
@stale stale bot closed this Jan 1, 2023
@srmncnk
Copy link
Contributor Author

srmncnk commented Jan 1, 2023

@felix-ht Can we reopen and do something with this?

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

Successfully merging this pull request may close these issues.

1 participant