Commit 0bc2b4dc authored by Christophe de Vienne's avatar Christophe de Vienne
Browse files

Use the request build_url function.

Building the redirection url without the request is an issue when the site is accessed
by https.
This make use of the req.build_url function in the web authentication retriever, so it
forges a consistent redirect_url for the oauth service.

Closes #3708047.
parent c9c7b8c225fb
......@@ -286,18 +286,6 @@ class ExternalAuthRetrieverStart(authentication.WebAuthInfoRetreiver):
__regid__ = 'externalauth-authenticate-start'
order = 9
def _base_url(self):
# NOTE self._cw is the registry !
return self._cw.config['base-url']
def _build_url(self, vid='view', **kwargs):
base_url = self._base_url()
# TODO some escaping is missing here, see if we can use urllib helpers
urlargs = urllib.urlencode(kwargs)
if urlargs:
return '%s%s?%s' % (base_url, vid, urlargs)
return '%s%s' % (base_url, vid)
def request_has_auth_info(self, req):
return '__externalauthprovider' in req.form
......@@ -325,7 +313,7 @@ class ExternalAuthRetrieverStart(authentication.WebAuthInfoRetreiver):
if not servicerset:
self.error('no service for provider: %s' % providername)
raise Redirect(self._build_url(
raise Redirect(req.build_url(
__message='no service for provider %s' % providername
......@@ -333,7 +321,7 @@ class ExternalAuthRetrieverStart(authentication.WebAuthInfoRetreiver):
negoid = make_uid('nego')
nego = {'service': service.eid,
'redirect_uri': self._build_url(
'redirect_uri': req.build_url(
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