Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Handle feedback given in #6634.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Mar 25, 2020
1 parent fd0ce13 commit 3d7e16d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions synapse/handlers/cas_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import logging
import xml.etree.ElementTree as ET
from typing import Awaitable, Dict, Optional, Tuple
from typing import AnyStr, Awaitable, Dict, Optional, Tuple

from six.moves import urllib

Expand Down Expand Up @@ -49,11 +49,11 @@ def __init__(self, hs):

self._http_client = hs.get_proxied_http_client()

def _build_service_param(self, client_redirect_url: str) -> str:
return "%s%s?redirectUrl=%s" % (
def _build_service_param(self, client_redirect_url: AnyStr) -> str:
return "%s%s?%s" % (
self._cas_service_url,
"/_matrix/client/r0/login/cas/ticket",
urllib.parse.quote(client_redirect_url, safe=""),
urllib.parse.urlencode({"redirectUrl": client_redirect_url}),
)

def _handle_cas_response(
Expand Down Expand Up @@ -150,12 +150,12 @@ async def _on_successful_auth(
registered_user_id, request, client_redirect_url
)

def handle_redirect_request(self, client_redirect_url: str) -> str:
def handle_redirect_request(self, client_redirect_url: bytes) -> bytes:
args = urllib.parse.urlencode(
{"service": self._build_service_param(client_redirect_url)}
)

return "%s/login?%s" % (self._cas_server_url, args)
return ("%s/login?%s" % (self._cas_server_url, args)).encode("ascii")

async def handle_ticket_request(self, request: SynapseRequest):
client_redirect_url = parse_string(request, "redirectUrl", required=True)
Expand Down

0 comments on commit 3d7e16d

Please sign in to comment.