Build the OAuth redirect URL ourselves, rather than relying on undocumented Flask behavior

This commit is contained in:
Joseph Schorr 2015-09-01 15:03:46 -04:00
parent b410ecd164
commit b7f487da42
3 changed files with 12 additions and 4 deletions

5
app.py
View file

@ -2,6 +2,7 @@ import logging
import os
import json
from functools import partial
from flask import Flask, request, Request, _request_ctx_stack
from flask.ext.principal import Principal
from flask.ext.login import LoginManager, UserMixin
@ -21,6 +22,7 @@ from data.buildlogs import BuildLogs
from data.archivedlogs import LogArchive
from data.userevent import UserEventsBuilderModule
from data.queue import WorkQueue, MetricQueueReporter
from util import get_app_url
from util.saas.analytics import Analytics
from util.saas.exceptionlog import Sentry
from util.names import urn_generator
@ -173,5 +175,4 @@ class LoginWrappedDBUser(UserMixin):
def get_id(self):
return unicode(self._uuid)
def get_app_url():
return '%s://%s' % (app.config['PREFERRED_URL_SCHEME'], app.config['SERVER_HOSTNAME'])
get_app_url = partial(get_app_url, app.config)