Fix untrusted dashboard host

The `openstack_auth login` view uses `request.build_absolute_uri` function
to build an origin uri when websso is enabled and
the WEBSSO_DEFAULT_REDIRECT_PROTOCOL is set.
This function doesn't insert the `WEBROOT` variable into uri what causes an
error:
    http://domain.name/auth/websso/ is not a trusted dashboard host
Using the `build_absolute_uri` from `utils` module fixes this problem. It
generates the right uri:
    http://domain.name/dashboard/auth/websso/

Change-Id: I94100f66a9f07eb8da75d344cbd120838fe25d1e
This commit is contained in:
Sergey Vilgelm 2019-01-22 18:21:29 -06:00
parent fbcc378e3e
commit 2842d7df37
No known key found for this signature in database
GPG Key ID: 08D0E2FF778887E6

View File

@ -62,7 +62,7 @@ def login(request, template_name=None, extra_context=None, **kwargs):
utils.is_websso_default_redirect()):
protocol = utils.get_websso_default_redirect_protocol()
region = utils.get_websso_default_redirect_region()
origin = request.build_absolute_uri('/auth/websso/')
origin = utils.build_absolute_uri(request, '/auth/websso/')
url = ('%s/auth/OS-FEDERATION/websso/%s?origin=%s' %
(region, protocol, origin))
return shortcuts.redirect(url)