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

added url as a parameter to allow user to set the url directly, becau… #65

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rmundkowsky
Copy link

Added url as a parameter to allow user to set the url directly, because oauth requires the exact url that LTI used, but the url can be changed by a redirect, rewrite, proxy, ssl offload, or etc.

For example, the LTI consumer might use https://foo.bar.com, but your app might be behind a load balancer, so url by the time it gets to the Flask app is http://server1.foo.bar.com:8443/

I had tried to make a decorator to do this, but was pretty complex. This approach is easier and will be commonly needed by LTI users anyways.

…se oauth requires the exact url that LTI used, but the url can be changed by a redirect, rewrite, proxy, ssl offload, or etc.
@amir-qayyum-khan
Copy link
Contributor

@rmundkowsky please fix pep8 issues

@rmundkowsky
Copy link
Author

I corrected pep 8 issues. I am not sure if I need to create new pull request or if this request will pull the corrected code.

Copy link
Contributor

@amir-qayyum-khan amir-qayyum-khan left a comment

Choose a reason for hiding this comment

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

So for multiple instance under load balancer, users need to change change url in each instance?

@@ -327,7 +327,7 @@ def close_session():
session[LTI_SESSION_KEY] = False


def lti(app=None, request='any', error=default_error, role='any',
def lti(app=None, request='any', error=default_error, role='any', url=None,
*lti_args, **lti_kwargs):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

please update the doc string

Copy link
Author

Choose a reason for hiding this comment

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

I added a comment as requested. Hopefully the comment will answer your question.

pylti/flask.py Outdated
@@ -339,6 +339,13 @@ def lti(app=None, request='any', error=default_error, role='any',
:param: request - Request type from
:py:attr:`pylti.common.LTI_REQUEST_TYPE`. (default: any)
:param: roles - LTI Role (default: any)
:param: url - This is an optional setting that allows you to set
Copy link
Contributor

Choose a reason for hiding this comment

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

pep8 issues

@rmundkowsky
Copy link
Author

pep8 corrected again. Sorry, about that.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 99.864% when pulling b9433f1 on rmundkowsky:master into 3266843 on mitodl:master.

@amir-qayyum-khan
Copy link
Contributor

please add unit test to assert that ur changed, pylti uses that url

@rmundkowsky
Copy link
Author

finally got back to this. I am not sure how to make a unit test for this.

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.

4 participants