diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-07-17 13:28:24 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-07-17 15:32:45 +0300 |
commit | 2ccc0561bf0099f0eeb5c095a56b839b096f8301 (patch) | |
tree | 5b96b0baa914c289c2c438c7b3449d04bfd2bf70 | |
parent | 5fe42dc5883b97696e2f5d3315e8311f27cebb63 (diff) | |
download | qvisqve-2ccc0561bf0099f0eeb5c095a56b839b096f8301.tar.gz |
Add: get callback URL from applications list
Albeig with a hard-coded application name, for now.
-rw-r--r-- | qvisqve/auth_router.py | 14 |
1 files 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) |