From c713f1741d482389b23f47a2c7bec4d244a5351a Mon Sep 17 00:00:00 2001 From: robert mundkowsky Date: Sat, 13 May 2017 13:29:01 -0400 Subject: [PATCH 1/4] 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. --- pylti/flask.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pylti/flask.py b/pylti/flask.py index 214c4ab..b0eab96 100644 --- a/pylti/flask.py +++ b/pylti/flask.py @@ -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): """ LTI decorator @@ -356,6 +356,8 @@ def wrapper(*args, **kwargs): Pass LTI reference to function or return error. """ try: + if url: + flask_request.url = url the_lti = LTI(lti_args, lti_kwargs) the_lti.verify() the_lti._check_role() # pylint: disable=protected-access From b78449f5bfae58790ec4ea46aa6786063e6a503d Mon Sep 17 00:00:00 2001 From: robert mundkowsky Date: Wed, 31 May 2017 09:00:31 -0400 Subject: [PATCH 2/4] pep 8 fixes --- pylti/flask.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylti/flask.py b/pylti/flask.py index b0eab96..b95f1c2 100644 --- a/pylti/flask.py +++ b/pylti/flask.py @@ -327,7 +327,7 @@ def close_session(): session[LTI_SESSION_KEY] = False -def lti(app=None, request='any', error=default_error, role='any',url=None, +def lti(app=None, request='any', error=default_error, role='any', url=None, *lti_args, **lti_kwargs): """ LTI decorator From ef31c467376d8af5fedc3b1c454e316ca2046a65 Mon Sep 17 00:00:00 2001 From: robert mundkowsky Date: Thu, 1 Jun 2017 09:31:36 -0400 Subject: [PATCH 3/4] added comment --- pylti/flask.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pylti/flask.py b/pylti/flask.py index b95f1c2..1795aa8 100644 --- a/pylti/flask.py +++ b/pylti/flask.py @@ -339,6 +339,13 @@ def lti(app=None, request='any', error=default_error, role='any', url=None, :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 + the url directly. For example, if you have a web + server as a proxy in front of the Flask server with a url of + https://abc.com/app that is mapped to your Flask server url + that is at https://abc.com/ then you can use this parameter + like this: url='https://abc.com/app' + :return: wrapper """ From b9433f1b3d3b684cef50e898be77bc581be38d83 Mon Sep 17 00:00:00 2001 From: robert mundkowsky Date: Thu, 1 Jun 2017 12:21:51 -0400 Subject: [PATCH 4/4] pep8 updated --- pylti/flask.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pylti/flask.py b/pylti/flask.py index 1795aa8..c3bb658 100644 --- a/pylti/flask.py +++ b/pylti/flask.py @@ -339,13 +339,13 @@ def lti(app=None, request='any', error=default_error, role='any', url=None, :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 - the url directly. For example, if you have a web - server as a proxy in front of the Flask server with a url of - https://abc.com/app that is mapped to your Flask server url - that is at https://abc.com/ then you can use this parameter - like this: url='https://abc.com/app' - + :param: url - This is an optional setting that allows you to set + the url directly. For example, if you have a web + server as a proxy in front of the Flask server with a url of + https://abc.com/app that is mapped to your Flask server url + that is at https://abc.com/ then you can use this parameter + like this: url='https://abc.com/app' + :return: wrapper """