From 8e8fb8e53f80cfddd15b510e1d06eacab7530726 Mon Sep 17 00:00:00 2001 From: Taizo 'Tsa6' Simpson Date: Thu, 21 Sep 2017 18:01:35 -0400 Subject: [PATCH] Added OAuth options to the config --- EpisodesCommunity/settings.py | 7 +++++++ options_example.ini | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/EpisodesCommunity/settings.py b/EpisodesCommunity/settings.py index 548e7ef..01e0fac 100644 --- a/EpisodesCommunity/settings.py +++ b/EpisodesCommunity/settings.py @@ -14,10 +14,12 @@ import dj_database_url import os import configparser import warnings +import base64 config = configparser.ConfigParser() config.read('options.ini') options = config['General'] +oauth_options = config['OAuth'] # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -128,3 +130,8 @@ USE_TZ = True # https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/static/' + + +AUTH_TOKEN_ENDPOINT = oauth_options.get('token_endpoint','https://icynet.eu/oauth/') +AUTH_B64 = base64.b64encode(bytearray('%s:%s'%(oauth_options.get('client_id'),oauth_options.get('client_secret')),'utf-8')) +AUTH_REDIRECT_URL = oauth_options.get('redirect_url') diff --git a/options_example.ini b/options_example.ini index 9d612ba..516fc94 100644 --- a/options_example.ini +++ b/options_example.ini @@ -9,3 +9,14 @@ secret_key=5up3r s3cr3t k3y #For configuration details database=sqlite:///database.sqlite3 +[OAuth] +#The root of the oauth endpoint you are using for oauth settings +token_endpoint=https://icynet.eu/oauth/ + +#The client id, client secret, and redirect url used in the confguration +#of your oauth client on the site that you plan to use for oauth. +#The redirect url should probably point to the appropriate view, and +#needs to be fully qualified. +client_id=CLIENT ID HERE +client_secret=CLIENT SECRET HERE +redirect_url=REDIRECT URL HERE