mitodl / mit_lti_flask_sample

a sample LTI provider using the PyLTI library and the Flask framework
23 stars 44 forks source link

Serve multiple LTI provider with one flask application #41

Open MatthiasWiesner opened 5 years ago

MatthiasWiesner commented 5 years ago

With this pull request, multiple LTI providers are to be served with one flask application.

In order to be able to run multiple LTI providers from one flask application, it is necessary to store the LTI properties of the different LTI providers independently of the flask session. If the LTI properties of an LTI provider are saved in the flask session, they will be overwritten by their LTI properties when using another LTI provider.

The LTI properties are stored as LTI session objects in a database. Only the user_id is stored in the flask session. The assignment of a flask request to the LTI session object happens via the flask session's user_id and the request url path (https://<host>:<port>/<path>).

For this, the pylti/flask.py ​​decorator had to be modified accordingly (pyltiflask.py). This modification uses the configuration of the flask application and has therefore been integrated into the flask application.

MatthiasWiesner commented 5 years ago

Hello, maybe you find this approach useful, then do not hesitate to write me for details. I can imagine that this pull request is hard to integrate, but maybe you can find the way I could not find.