'Validate and return originating dashboard URL.
Make sure the parameter is specified in the request\'s URL as well its
value belongs to a list of trusted dashboards.
:param context: request\'s context
:raises keystone.exception.ValidationError: ``origin`` query parameter
was not specified. The URL is deemed invalid.
:raises keystone.exception.Unauthorized: URL specified in origin query
parameter does not exist in list of websso trusted dashboards.
:returns: URL with the originating dashboard'

def _get_sso_origin_host(self, request):

    origin = request.params.get('origin')
    if (not origin):
        msg = _('Request    must    have    an    origin    query    parameter')
        LOG.error(msg)
        raise exception.ValidationError(msg)
    host = urllib.parse.unquote_plus(origin)
    trusted_dashboards = [k_utils.lower_case_hostname(trusted) for trusted in CONF.federation.trusted_dashboard]
    if (host not in trusted_dashboards):
        msg = _('%(host)s    is    not    a    trusted    dashboard    host')
        msg = (msg % {'host': host})
        LOG.error(msg)
        raise exception.Unauthorized(msg)
    return host
