Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

fix: add configuration to enable correct redirect_uri #36

Merged
merged 3 commits into from
May 24, 2023

Conversation

mariajgrimaldi
Copy link
Contributor

@mariajgrimaldi mariajgrimaldi commented May 12, 2023

Description

This PR adds a configuration that enables the service provider (superset) to build the redirect_uri correctly matching the one created on the LMS site (identify provider).

For more information on this solution, please check these superset configurations: https://github.com/apache/superset/blob/master/superset/config.py#L273-L277

This PR solves #30

How to test

In a production environment (using https):

  1. Install this branch: pip install git+https://github.com/eduNEXT/tutor-contrib-superset.git@MJG/redirect-uri-fix
  2. tutor config save
  3. tutor local start -d
  4. Now, try login in to superset:
    image
    Check the redirect_uri has the correct schema.

References

dpgaspar/Flask-AppBuilder#1666
apache/superset#8117
apache/airflow#17536 (comment)

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label May 12, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented May 12, 2023

Thanks for the pull request, @mariajgrimaldi! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@itsjeyd
Copy link

itsjeyd commented May 16, 2023

label: core contributor

@github-actions github-actions bot added the core contributor PR author is a Core Contributor (who may or may not have write access to this repo). label May 16, 2023
@itsjeyd
Copy link

itsjeyd commented May 16, 2023

@mariajgrimaldi Thanks for these changes! Let us know when they're ready for review.

@itsjeyd itsjeyd added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label May 16, 2023
@mariajgrimaldi mariajgrimaldi marked this pull request as ready for review May 16, 2023 16:36
@mariajgrimaldi
Copy link
Contributor Author

Thanks! This is ready for review :)


{% if ENABLE_HTTPS %}
ENABLE_PROXY_FIX = True
FEATURE_FLAGS = {
Copy link
Collaborator

@bmtcril bmtcril May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written this will overwrite the FEATURE_FLAGS from above, but I think this is a big enough change that we either want it on or off since it's not really related to HTTPS. Is there a plugin needed for the proxy fix?

Copy link
Contributor Author

@mariajgrimaldi mariajgrimaldi May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this without the override and I think it works. So we're good. Now, regarding the https issue, I'm no expert so I'll go with what you suggest. Our setups (docker-compose, k8s) are behind a proxy (caddy, a lb) so we needed the change in both cases. Maybe someone won't. Should we use something like SUPERSET_ENABLE_PROXY_FIX?

Is there a plugin needed for the proxy fix?

No, this is part of the superset config: https://github.com/apache/superset/blob/master/superset/config.py#L273-L277

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably make it a flag, sadly. For instance I think that running tutor dev doesn't use the caddy proxy. Otherwise looks good!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running tutor dev the setting ENABLE_HTTPS should be False so we're good as it is right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I'll follow these changes instead:

{% if not ENABLE_WEB_PROXY %}
# Caddy is running behind a proxy: Superset needs to handle x-forwarded-* headers
# https://flask.palletsprojects.com/en/latest/deploying/proxy_fix/
ENABLE_PROXY_FIX = True
{% endif %}

From the tutor-cairn plugin

@bmtcril bmtcril merged commit 94c066a into openedx-unsupported:main May 24, 2023
@openedx-webhooks
Copy link

@mariajgrimaldi 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@itsjeyd itsjeyd removed the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label May 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants