From 2ccc0561bf0099f0eeb5c095a56b839b096f8301 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 17 Jul 2018 13:28:24 +0300 Subject: Add: get callback URL from applications list Albeig with a hard-coded application name, for now. --- qvisqve/auth_router.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/qvisqve/auth_router.py b/qvisqve/auth_router.py index d4f3ca6..4e4bec1 100644 --- a/qvisqve/auth_router.py +++ b/qvisqve/auth_router.py @@ -22,9 +22,9 @@ import qvisqve class AuthRouter(qvisqve.Router): - def __init__(self, callback_url): + def __init__(self, apps): super().__init__() - self._callback_url = callback_url + self._apps = apps def get_routes(self): return [ @@ -37,6 +37,10 @@ class AuthRouter(qvisqve.Router): ] def _auth(self, content_type, body, *args, **kwargs): + qvisqve.log.log( + 'xxx', msg_text='_auth called', content_type=content_type, + body=body, args=args, kwargs=kwargs) + if content_type != 'application/x-www-form-urlencoded': return qvisqve.bad_request_response('Wrong content type') @@ -45,7 +49,11 @@ class AuthRouter(qvisqve.Router): # - create and store auth code # - use callback url provided in request + callback_url = self._apps.get('facade') # FIXME get real app name + params = urllib.parse.urlencode({'code': 123}) - url = '{}?{}'.format(self._callback_url, params) + url = '{}?{}'.format(callback_url, params) + + qvisqve.log.log('xxx', msg_text='Returning redirect', url=url) return qvisqve.found_response('Redirect to callback url', url) -- cgit v1.2.1