Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Fixes #2 - Initial commit to add OAuth support
Browse files Browse the repository at this point in the history
  • Loading branch information
jonespm committed Jan 21, 2022
1 parent 3830935 commit 3f55b12
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
##### Required value
##### Required values
# Django Secret key. Run the command below to generate and insert this.
# You should set this to production but the start script generates one each time if not set

# python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
# DJANGO_SECRET_KEY=<some secret key, randomized by default>

# Canvas OAuth Config
# (required) The client id is the integer client id value of your Canvas developer key.
# CANVAS_OAUTH_CLIENT_ID=

# (required) The client secret is the random string (secret) value of your Canvas developer key.
# CANVAS_OAUTH_CLIENT_SECRET=

# (required) The domain of your canvas instance (e.g. canvas.instructure.com)
# CANVAS_OAUTH_CANVAS_DOMAIN=

##### Optional configuration for defining hosts
# Need to define this if using ngrok or other hosts
ALLOWED_HOSTS=.ngrok.io,.localhost,127.0.0.1
Expand Down
3 changes: 2 additions & 1 deletion backend/canvas_app_explorer/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
path('lti/jwks/', lti1p3.get_jwks, name='lti_get_jwks'),
path('lti/config/', lti1p3.generate_config_json, name=lti1p3.generate_config_json.__name__),
path('tinymce/', include('tinymce.urls')),
]
path('oauth/', include('canvas_oauth.urls')),
]
12 changes: 12 additions & 0 deletions backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'rest_framework',
'pylti1p3.contrib.django.lti1p3_tool_config',
'tinymce',
'canvas_oauth.apps.CanvasOAuthConfig',
]

MIDDLEWARE = [
Expand All @@ -59,6 +60,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'canvas_oauth.middleware.OAuthMiddleware',
]

ROOT_URLCONF = 'backend.urls'
Expand Down Expand Up @@ -204,9 +206,19 @@
},
}

<<<<<<< HEAD
TINYMCE_DEFAULT_CONFIG = {
'menubar': True,
"plugins": "advlist,autolink,lists,link,anchor,insertdatetime,media,table,paste,",
"toolbar": "formatselect | bold italic backcolor | "
"bullist numlist outdent indent | removeformat | help",
}
=======
# OAuth Settings, get thse from the environment
CANVAS_OAUTH_CLIENT_ID = os.getenv('CANVAS_OAUTH_CLIENT_ID', 'canvas_app_explorer')
CANVAS_OAUTH_CLIENT_SECRET = os.getenv('CANVAS_OAUTH_CLIENT_SECRET', 'canvas_app_explorer')
CANVAS_OAUTH_CANVAS_DOMAIN = os.getenv('CANVAS_OAUTH_CANVAS_DOMAIN', 'canvas.instructure.com')
CANVAS_OAUTH_SCOPES = os.getenv('CANVAS_OAUTH_SCOPES', '').split(',')
CANVAS_OAUTH_TOKEN_EXPIRATION_BUFFER = os.getenv('CANVAS_OAUTH_TOKEN_EXPIRATION_BUFFER', '0')
CANVAS_OAUTH_ERROR_TEMPLATE = os.getenv('CANVAS_OAUTH_ERROR_TEMPLATE', 'canvas_app_explorer/oauth_error.html')
>>>>>>> 1f12da3 (Fixes #2 - Initial commit to add OAuth support)
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ django-filter # Filtering support
#LTI
PyLTI1p3==1.9.1

# Not in pypi https://github.com/Harvard-University-iCommons/django-canvas-oauth
https://github.com/Harvard-University-iCommons/django-canvas-oauth/archive/v1.1.0.tar.gz

# For serving static files
whitenoise==5.3.0

0 comments on commit 3f55b12

Please sign in to comment.