- Nov 07, 2022
-
-
Andy Shultz authored
For the config model we do not need to go as far as binding the block to the user and already get enough data out of the modulestore to satisfy the storage on the xblock case. Add a new function to get that much xblock only. For the limited cases where we are using the block more directly as a block we maintain the old function. Also includes a fix to test_views that was closing the wrong level mock and leaving an open patch into other tests.
-
- Nov 04, 2022
-
-
Varsha authored
Python Requirements Update
-
Andrew Shultz authored
docs: emphasize that for dev the xblock must be installed in two containers
-
Andy Shultz authored
-
- Nov 02, 2022
-
-
edX requirements bot authored
-
- Nov 01, 2022
-
-
Michael Roytman authored
Add ADR for decoupling LTI launches from the XBlock
-
michaelroytman authored
This commit adds an ADR describing our strategy for decoupling LTI launches from the XBlock and from the edX platform.
-
- Oct 26, 2022
-
-
Andrew Shultz authored
feat: add override for the LMS_BASE_URL in various LTI settings
-
Andrew Shultz authored
API gets config from launch data via config_id
-
- Oct 25, 2022
-
-
Andy Shultz authored
... without messing up the rest of your world by changing the LMS base URL for everyone. Meant for ngrok testing of LTI 1.3.
-
- Oct 20, 2022
-
-
Andy Shultz authored
these functions require the LMS environment which is not available in test so they are generally mocked away. Mark them as such.
-
Andy Shultz authored
-
Andy Shultz authored
Note that this uses config_id (the UUID) not config.id (the int) This required a way to get config_id if we only have the block. And it means that we are more likely to go through load_block_as_user because we have not created the config off the block even when calling from the block (since the block has to go through that config ID). A lot of tests had to be updated to have more complete configuration setup because config_id is now load bearing.
-
Andy Shultz authored
Sometimes we need to load the block. Current code always rebinds the block to the anonymous user because we might not have a user. But in many cases we do have a user and may have already loaded and bound the block in question. Check for user and request and if the block is already bound and just use that block if possible or at least load the block with the user you actually have.
-
- Oct 19, 2022
-
-
Andy Shultz authored
-
- Oct 18, 2022
-
-
Michael Roytman authored
LTI 1.3 Fixes: Clickjacking Protection Preventing Launch and Incorrect Authentication Response/Launch URL
-
- Oct 17, 2022
-
-
michaelroytman authored
-
michaelroytman authored
This commit fixes a bug in the way we determine where to send the authentication response - the LTI 1.3 launch message - as part of an LTI 1.3 launch. According to the 1EdTech Security Framework 1.0, during an LTI 1.3 launch, "the authentication response is sent to the redirect_uri." The redirect_uri is a query or form parameter provided by the tool when it directs the browser to make a request to the Platform's authentication endpoint. However, we currently send the authentication response to the preregistered launch URL - lti_1p3_launch_url in the LtiConsumerXBlock or the LtiConfiguration model. The difference is subtle, but it is important, because the specification indicates the Platform should respect the redirect_uri provided by the Tool, assuming it is a valid redirect_uri. During the pregistration phase, "the Tool must provide one or multiple redirect URIs that are valid end points where the authorization response can be sent. The number of distinct redirect URIs to be supported by a platform is not specified." Currently, we do not support multiple redirect URIs, so the change is not immediately impactful. However, we should follow the specification and ensure that we return the authentication response to the correct URL.
-
michaelroytman authored
This commit fixes a bug caused by the X-Frame-Options response header. The X-Frame-Options response header indicates to the browser whether a site's content can be loaded within certain tags, including the <iframe> tag. This is a form of clickjacking protection. In Django, this response header is set by the django.middleware.clickjacking.XFrameOptionsMiddleware middleware. In the edx-platform, by default, X-Frame-Options is set to DENY (see the X_FRAME_OPTIONS Django setting), which means that the response content returned by Django views cannot be loaded within certain tags. However, this behavior can be disabled by decorating views with the django.views.decorators.clickjacking.xframe_options_exempt view decorator. This creates a problem for LTI 1.3 lauches in the edx-platform. When an LTI component is loaded, the LtiConsumerXBlock is loaded via the lms.djangoapps.courseware.views.views.render_xblock_view view. This view is called an <iframe> tag, but the view is decorated by the xfame_options_exempt decorator, which disables clickjacking protection and communicates to the browser that the content can be loaded in the <iframe> tag. Once the third-party login request of the LTI 1.3 launch is completed, the LTI tool directs the browser to make a request to the launch_gate_endpoint. This endpoint returns a response, which is an auto-submitting form that makes a POST request - the LTI launch request - to the tool. This view has clickjacking enabled, so the browser blocks the requests, which prevents the launch from occurring. This commit adds the xframe_options_exempt view decorator to the launch_gate_endpoint view. Note that LTI 1.1 does not have this bug, because the LTI launch request is handled via the lti_launch_handler. The XBlock runtime handles requests to the LTI handlers via the openedx.core.djangoapps.xblock.rest_api.views.xblock_handler view, which is also decorated by the xframe_options_exempt view decorator.
-
- Oct 13, 2022
-
-
Michael Roytman authored
feat: decouple LTI 1.3 launch from the XBlockLtiConsumer
-
michaelroytman authored
Purpose ------- The purpose of these changes is to decouple the LTI 1.3 launch from the LtiConsumerXBlock. It is in accordance with the ADR "0007 Decouple LTI 1.3 Launch from XBlock and edX Platform", which is currently under review. The pull request for the ADR is here: https://github.com/openedx/xblock-lti-consumer/pull/281. The general premise of these changes is to shift the responsibility of defining key launch claims to users of the library. Such claims include user ID, user role, resource link ID, etc. Prior to this change, this context was defined directly in the launch view by referencing XBlock fields and functions, thereby tying the LTI 1.3 launch to the XBlock. By shifting the responsibility out of the view, we will be able to genericize the launch and make it functional in more contexts than just the XBlock and the XBlock runtime. In short, the key launch claims are encoded in an instance of a data class Lti1p3LaunchData. Users of the library will instantiate this class with necessary launch data to it and pass the instance to various methods of the Python API to communicate the data to the library. Please see the aforementioned ADR for more details about this decoupling strategy. Note that the majority of these changes affect only the basic LTI 1.3 launch. There have largely been no changes to LTI 1.3 Advantage Services. The one exception is the Deep Linking content launch endpoint. This is because this launch is implemented in the basic LTI 1.3 launch, and it was necessary to make the same changes to the deep linking content launch to ensure that it works properly. Otherwise, LTI 1.3 Advantage Services are out of scope of these changes. Change Summary for Developers ----------------------------- Below is a summary of changes contained in this pull request. * added an Lti1p3LaunchData data class * added caching for Lti1p3LaunchData to limit data sent in request query or form parameters * BREAKING CHANGE: modified Python API methods to take Lti1p3LaunchData as a required argument ** get_lti_1p3_launch_info ** get_lti_1p3_launch_start_url ** get_lti_1p3_content_url * replaced references to LtiConsumerXBlock.location with Lti1p3LaunchData.config_id * removed definition of key LTI 1.3 claims from the launch_gate_endpoint and instantiated Lti1p3LaunchData from within the LtiConsumerXBlock instead * added a required launch_data_key request query parameter to the deep_linking_content_endpoint and refactored associated templates and template tags to pass this parameter in the request to the view Change Summary for Course Staff and Instructors ----------------------------------------------- The only changes relevant for course staff and instructors is that the access token and keyset URLs displayed in Studio have changed in format. The old format was: Access Token URL: https://courses.edx.org/api/lti_consumer/v1/token/block-v1:edX+999+2022Q3+type@lti_consumer+block@714c10a5e4df452da9d058788acb56be Keyset URL: https://courses.edx.org/api/lti_consumer/v1/public_keysets/block-v1:edX+999+2022Q3+type@lti_consumer+block@714c10a5e4df452da9d058788acb56be The new format is: Access Token URL: https://courses.edx.org/api/lti_consumer/v1/token/c3f6af60-dbf2-4f85-8974-4ff870068d43 Keyset URL: https://courses.edx.org/api/lti_consumer/v1/public_keysets/c3f6af60-dbf2-4f85-8974-4ff870068d43 The difference is in the slug at the end of the URL. In the old format, the slug was the UsageKey of the XBlock associated with the LTI integration. In the new format, the slug is the config_id of the LtiConfiguration associated with the LTI integration. This is an iterative step toward decoupling the access_token_endpoint and the public_keyset_endpoint views from the XBlock location field. The XBlock location field appears as the usage_key parameter to both views. We cannot simply remove the usage_key parameter from the views, because existing LTI 1.3 integrations may have been created using the old format, and we need to maintain backwards compatibility. This change, however, prevents new integrations from being created that are coupled to the XBlock. In the future, we may address integrations that use the old format to fully decouple the XBlock from the views. Testing ------- Unit tests were added for all changes. In addition, manual testing was performed using the instructions in the documents listed below. * https://github.com/openedx/xblock-lti-consumer#lti-13 * https://openedx.atlassian.net/wiki/spaces/COMM/pages/1858601008/How+to+run+the+LTI+Validation+test Resources --------- JIRA: MST-1603: https://2u-internal.atlassian.net/browse/MST-1603 BREAKING CHANGE
-
- Oct 03, 2022
-
-
edX requirements bot authored
* chore: Updating Python Requirements * fix: update is_valid arg Co-authored-by:
Alie Langston <alangsto@wellesley.edu>
-
- Sep 28, 2022
-
-
David Ormsbee authored
This should add this repo as a subcomponent of: https://backstage.openedx.org/catalog/default/component/LTI
-
- Sep 20, 2022
-
-
Andrew Shultz authored
Python Requirements Update
-
Feanil Patel authored
docs: Update catalog-info.yaml
-
Feanil Patel authored
* Remove an unnecessary annotation * Add a comment back to the reference file and relevant OEP
-
Feanil Patel authored
Backstage will automatically pick up `yaml` files but not `yml` files.
-
- Sep 16, 2022
-
-
edX requirements bot authored
-
- Sep 14, 2022
-
-
Zachary Hancock authored
-
- Sep 13, 2022
-
-
Zachary Hancock authored
* docs: readme badges and refactor * feat: add backstage catalog-info
-
- Sep 02, 2022
-
-
edX requirements bot authored
-
- Aug 22, 2022
-
-
Michael Roytman authored
Handle LtiError Error During LTI 1.1 Launch When Calling user_id for Unauthenticated User
-
michaelroytman authored
In the LTI 1.1 launch handler, we set the user context, including the user_id. We do this by calling to the LMS's DjangoXBlockUserService to get information about the user. Sometimes, the user is unauthenticated. Sometimes, this is because the user is a web crawler. Other times, the user is a real user, but we do not know why the user is unauthenticated. We have some theories, but we have been unable to confirm them. Regardless, we should not surface a 500 error to the user. This commit adds handling for the LtiError that is raised when a user is unauthenticated during an LTI 1.1 launch. It catches the LtiError and renders an error page. The error page that was used for LTI 1.3 launches, formerly named "lti_1p3_launch_error.html", has been renamed to "lti_launch_error.html" to reflect the fact that it is used for both LTI 1.1 and 1.3 launches. It was modified to remove the reference to the version of LTI used by the XBlock; these details are unnecessary for a learner, and removing them allows us to reuse a single template for both LTI versions.
-
- Aug 19, 2022
-
-
michaelroytman authored
This reverts commit 617d8781. We have determined an appropriate course of action for these errors, so the additional logging is no longer necessary and should be removed.
-
- Aug 18, 2022
-
-
Andrew Shultz authored
Python Requirements Update
-
- Aug 17, 2022
-
-
Arunmozhi authored
Move XBlock endpoints to Django models and implement backwards compatible views. Relevant commits: * refactor: move LTI 1.3 access token endpoint to plugin view * refactor: remove the xblock handler and add tests to api view * refactor: move the lti_1p3_launch_callback logic to the django view * feat: adds access token view for backward compatibility * refactor: make launch urls use config_id when block is missing * refactor: remove launch_callback_handler from XBlock
-
- Aug 16, 2022
-
-
edX requirements bot authored
-
- Aug 03, 2022
-
-
Michael Roytman authored
Python Requirements Update
-
Michael Roytman authored
fix: missing exception details in logs
-
- Aug 02, 2022
-
-
michaelroytman authored
The error handler in LtiConsumerXBlock.lti_1p3_launch_callback logs a warning when a select set of exceptions are handled. That log does not contain useful information about the nature of the exception, because the exceptions were not being instantiated with error messages. The try...catch is a large block that contains code that can raise a multitude of errors, so these changes will enable better debugging. This commit: * adds helpful messages to the raised exceptions. * adds the "exc_info=True" argument to include the stack trace of the handled exception. * adds ValueError and TypeError to the list of handled exceptions, because the code can raise exceptions of these types.
-