-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I2 login user after the LTI launch (#7)
- Loading branch information
Showing
9 changed files
with
209 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,64 @@ | ||
# canvas-lti-redirect-tool | ||
This is Canvas LTI redirect tool which use the CAI developed [LTI library](https://pypi.org/project/django-lti/) | ||
|
||
## Generating Django security key | ||
### Prerequisites | ||
|
||
To follow the instructions below, you will at minimum need the following: | ||
1. **[Docker Desktop](https://www.docker.com/products/docker-desktop/)**. | ||
1. **[Git](https://git-scm.com/downloads)** | ||
### Installation and Setup | ||
1. You need to web Proxy like Loophole or ngrok to run the application. Loophole offers custom domain | ||
```sh | ||
loophole http 6000 --hostname <your-host> | ||
``` | ||
1. Copy the `.env.sample` file as `.env`. | ||
```sh | ||
cp .env.sample .env | ||
1. Examine the `.env` file. It will have the suggested default environment variable settings, | ||
mostly just MySQL information as well as locations of other configuration files. | ||
1. Start the Docker build process (this will take some time). | ||
```sh | ||
docker compose build | ||
``` | ||
|
||
1. Start up the web server and database containers. | ||
```sh | ||
docker compose up | ||
``` | ||
|
||
1. generate Django secret using below command | ||
```sh | ||
python manage.py shell -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())" | ||
``` | ||
|
||
## LTI install | ||
1. Need to run this command once in order for LTI to work | ||
1. Need to run this command once docker container is up in order for LTI to work. This is important step otherwise the LTI tool launch won't happen | ||
```sh | ||
docker exec -it clrt_web /bin/bash -c \ | ||
"python manage.py rotate_keys" | ||
``` | ||
2. Create superuser via using `python manage.py createsuperuser', need to run a proxy like loophole or ngrok for LTI installation and login with that user. | ||
https://<url>/admin/ | ||
4. Use `LTIRegistration` to configure an LTI tool | ||
``` | ||
2. Create superuser via using `python manage.py createsuperuser', need to run a proxy like loophole or ngrok for LTI installation and login with that user. Go to https://{app-hostname}/admin/. | ||
3. Go to Canvas instance, choose Developer Keys in admin site | ||
4. Add LTI Key | ||
5. Choose Paste JSON method | ||
6. Goto `LTIRegistration` to configure an LTI tool from admin console. This will create the `uuid` automatically. Hold on to that value and update the `OpenID Connect Initiation Url` in the LTI tool registration from Canvas with this id. | ||
` for Eg: https://clrt-local.loophole.site/init/0b54a91b-cac6-4c96-ba1e/` | ||
7. use the `setup/lti-config.json` for registing the LTI tool. Replace all the `{app-hostname}` with your web proxy url and <uuid:lti-registration> with UUID value from LTI tool registration. | ||
8. Configure the LTI configuration from CLRT tool going to admin again. Give the following value. Note: `<canvas-instance>: ['canvas.test', 'canvas.beta']` | ||
1. Name: any name | ||
2. Issuer: https://<canvas-instance>.instructure.com | ||
2. Client ID: (get this from Platform) | ||
3. Auth URL: https://<canvas-instance>.instructure.com/api/lti/authorize_redirect | ||
4. Access token URL: https://<canvas-instance>.instructure.com/login/oauth2/token | ||
5. Keyset URL: https://<canvas-instance>.instructure.com/api/lti/security/jwks | ||
6. DEPLOYMENT ID: get this as it is described the step 7 and paste | ||
9. Save | ||
10. Go to the Canvas(platform) add the LTI tool at account/course level and copy the deployment id by clicking the setting button next to it. | ||
|
||
## Make a user superuser | ||
1. go to the `auth_user` table and set `is_superuser` and `is_staff` to `1` or `true` this will give the logged user access to admin interface | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<title>{% block title %}{% endblock %}</title> | ||
{% load static %} | ||
<link rel="stylesheet" type="text/css" href="{% static 'home.css' %}"/> | ||
</head> | ||
|
||
<body> | ||
<p>Error occured during launch the Canvas LTI Redirect Tool</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"title": "Canvas LTI Redirect Tool", | ||
"scopes": [], | ||
"extensions": [ | ||
{ | ||
"domain": "{app-hostname}", | ||
"platform": "canvas.instructure.com", | ||
"settings": { | ||
"platform": "canvas.instructure.com", | ||
"placements": [ | ||
{ | ||
"default": "disabled", | ||
"placement": "course_navigation", | ||
"message_type": "LtiResourceLinkRequest", | ||
"target_link_uri": "https://{app-hostname}/ltilaunch" | ||
} | ||
] | ||
}, | ||
"privacy_level": "public" | ||
} | ||
], | ||
"public_jwk": {}, | ||
"description": "This is canvas LTI redirect tool", | ||
"custom_fields": { | ||
"roles": "$Canvas.membership.roles", | ||
"term_id": "$Canvas.term.id", | ||
"login_id": "$Canvas.user.loginId", | ||
"term_end": "$Canvas.term.endAt", | ||
"course_id": "$Canvas.course.id", | ||
"term_name": "$Canvas.term.name", | ||
"canvas_url": "$Canvas.api.baseUrl", | ||
"term_start": "$Canvas.term.startAt", | ||
"redirect_url": "https://dev.dev.umgpt.umich.edu/", | ||
"course_status": "$Canvas.course.workflowState", | ||
"user_canvas_id": "$Canvas.user.id", | ||
"course_account_name": "$Canvas.account.name", | ||
"course_enroll_status": "$Canvas.enrollment.enrollmentState", | ||
"course_sis_account_id": "$Canvas.course.sisSourceId", | ||
"course_canvas_account_id": "$Canvas.account.id" | ||
}, | ||
"public_jwk_url": "https://{app-hostname}/.well-known/jwks.json", | ||
"target_link_uri": "https://{app-hostname}/ltilaunch", | ||
"oidc_initiation_url": "https://{app-hostname}/init/<uuid:lti-registration>/" | ||
} |