Commit 9d308ff8 by Mushtaq Ali

Add JWT AUTH settings - EDUCATOR-1510

parent f8612e82
...@@ -110,6 +110,15 @@ DATABASES = { ...@@ -110,6 +110,15 @@ DATABASES = {
} }
} }
# NOTE: JWT_SECRET_KEY is intentionally not set here to avoid production releases with a public value.
# Set a value in a downstream settings file.
JWT_AUTH = {
'JWT_AUDIENCE': 'video-pipeline',
'JWT_ISSUER': 'video-pipeline',
'JWT_DECODE_HANDLER': 'edx_rest_framework_extensions.utils.jwt_decode_handler',
'JWT_VERIFY_AUDIENCE': False,
}
REST_FRAMEWORK = { REST_FRAMEWORK = {
'PAGE_SIZE': 10, 'PAGE_SIZE': 10,
'DEFAULT_PARSER_CLASSES': ( 'DEFAULT_PARSER_CLASSES': (
...@@ -119,6 +128,7 @@ REST_FRAMEWORK = { ...@@ -119,6 +128,7 @@ REST_FRAMEWORK = {
'rest_framework.permissions.IsAuthenticated', 'rest_framework.permissions.IsAuthenticated',
), ),
'DEFAULT_AUTHENTICATION_CLASSES': ( 'DEFAULT_AUTHENTICATION_CLASSES': (
'edx_rest_framework_extensions.authentication.JwtAuthentication',
'oauth2_provider.ext.rest_framework.OAuth2Authentication', 'oauth2_provider.ext.rest_framework.OAuth2Authentication',
'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.SessionAuthentication',
......
...@@ -17,6 +17,13 @@ DATABASES = { ...@@ -17,6 +17,13 @@ DATABASES = {
} }
# END DATABASE CONFIGURATION # END DATABASE CONFIGURATION
JWT_AUTH.update({
'JWT_SECRET_KEY': 'lms-secret',
'JWT_ISSUER': 'http://127.0.0.1:8000/oauth2',
'JWT_AUDIENCE': 'lms-key',
'JWT_VERIFY_AUDIENCE': False
})
# See if the developer has any local overrides. # See if the developer has any local overrides.
if os.path.isfile(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'private.py')): if os.path.isfile(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'private.py')):
from .private import * # pylint: disable=import-error, wildcard-import from .private import * # pylint: disable=import-error, wildcard-import
...@@ -10,7 +10,7 @@ ALLOWED_HOSTS = ['*'] ...@@ -10,7 +10,7 @@ ALLOWED_HOSTS = ['*']
# Keep track of the names of settings that represent dicts. Instead of overriding the values in base.py, # Keep track of the names of settings that represent dicts. Instead of overriding the values in base.py,
# the values read from disk should UPDATE the pre-configured dicts. # the values read from disk should UPDATE the pre-configured dicts.
DICT_UPDATE_KEYS = ('DATABASES', 'SECRET_KEY', 'STATIC_ROOT_PATH') DICT_UPDATE_KEYS = ('DATABASES', 'SECRET_KEY', 'STATIC_ROOT_PATH', 'JWT_AUTH')
CONFIG_DATA = get_config() CONFIG_DATA = get_config()
# Remove the items that should be used to update dicts, and apply them separately rather # Remove the items that should be used to update dicts, and apply them separately rather
......
...@@ -25,6 +25,14 @@ SECRET_KEY: "" ...@@ -25,6 +25,14 @@ SECRET_KEY: ""
# (set to false in prod) # (set to false in prod)
debug: false debug: false
# JWT AUTH settings
JWT_AUTH:
JWT_SECRET_KEY':
JWT_ISSUER':
JWT_AUDIENCE':
JWT_VERIFY_AUDIENCE':
# --- # ---
# AWS Buckets, Prefixes # AWS Buckets, Prefixes
# --- # ---
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment