diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2016-09-09 21:57:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-09 21:57:42 +0100 |
commit | 4162f820ff7aca658372b4d642fdc801a821d265 (patch) | |
tree | a723a6c74162cf1d42242d6b4f6d68077aaa39cb /synapse | |
parent | Merge pull request #1099 from matrix-org/dbkr/make_notif_highlight_query_fast (diff) | |
parent | Conform better to the CAS protocol specification (diff) | |
download | synapse-4162f820ff7aca658372b4d642fdc801a821d265.tar.xz |
Merge pull request #1100 from VShell/fix-cas
Conform better to the CAS protocol specification
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/rest/client/v1/login.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py index 6c0eec8fb3..345018a8fc 100644 --- a/synapse/rest/client/v1/login.py +++ b/synapse/rest/client/v1/login.py @@ -318,7 +318,7 @@ class CasRedirectServlet(ClientV1RestServlet): service_param = urllib.urlencode({ "service": "%s?%s" % (hs_redirect_url, client_redirect_url_param) }) - request.redirect("%s?%s" % (self.cas_server_url, service_param)) + request.redirect("%s/login?%s" % (self.cas_server_url, service_param)) finish_request(request) @@ -385,7 +385,7 @@ class CasTicketServlet(ClientV1RestServlet): def parse_cas_response(self, cas_response_body): user = None - attributes = None + attributes = {} try: root = ET.fromstring(cas_response_body) if not root.tag.endswith("serviceResponse"): @@ -395,7 +395,6 @@ class CasTicketServlet(ClientV1RestServlet): if child.tag.endswith("user"): user = child.text if child.tag.endswith("attributes"): - attributes = {} for attribute in child: # ElementTree library expands the namespace in # attribute tags to the full URL of the namespace. @@ -407,8 +406,6 @@ class CasTicketServlet(ClientV1RestServlet): attributes[tag] = attribute.text if user is None: raise Exception("CAS response does not contain user") - if attributes is None: - raise Exception("CAS response does not contain attributes") except Exception: logger.error("Error parsing CAS response", exc_info=1) raise LoginError(401, "Invalid CAS response", |