Skip to content
Snippets Groups Projects
Unverified Commit 26837d5d authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

Do not require the CAS service URL setting (use public_baseurl instead). (#9199)

The current configuration is handled for backwards compatibility,
but is considered deprecated.
parent dd8da8c5
No related branches found
No related tags found
No related merge requests found
The `service_url` parameter in `cas_config` is deprecated in favor of `public_baseurl`.
...@@ -1878,10 +1878,6 @@ cas_config: ...@@ -1878,10 +1878,6 @@ cas_config:
# #
#server_url: "https://cas-server.com" #server_url: "https://cas-server.com"
# The public URL of the homeserver.
#
#service_url: "https://homeserver.domain.com:8448"
# The attribute of the CAS response to use as the display name. # The attribute of the CAS response to use as the display name.
# #
# If unset, no displayname will be set. # If unset, no displayname will be set.
......
...@@ -30,7 +30,13 @@ class CasConfig(Config): ...@@ -30,7 +30,13 @@ class CasConfig(Config):
if self.cas_enabled: if self.cas_enabled:
self.cas_server_url = cas_config["server_url"] self.cas_server_url = cas_config["server_url"]
self.cas_service_url = cas_config["service_url"] public_base_url = cas_config.get("service_url") or self.public_baseurl
if public_base_url[-1] != "/":
public_base_url += "/"
# TODO Update this to a _synapse URL.
self.cas_service_url = (
public_base_url + "_matrix/client/r0/login/cas/ticket"
)
self.cas_displayname_attribute = cas_config.get("displayname_attribute") self.cas_displayname_attribute = cas_config.get("displayname_attribute")
self.cas_required_attributes = cas_config.get("required_attributes") or {} self.cas_required_attributes = cas_config.get("required_attributes") or {}
else: else:
...@@ -53,10 +59,6 @@ class CasConfig(Config): ...@@ -53,10 +59,6 @@ class CasConfig(Config):
# #
#server_url: "https://cas-server.com" #server_url: "https://cas-server.com"
# The public URL of the homeserver.
#
#service_url: "https://homeserver.domain.com:8448"
# The attribute of the CAS response to use as the display name. # The attribute of the CAS response to use as the display name.
# #
# If unset, no displayname will be set. # If unset, no displayname will be set.
......
...@@ -54,8 +54,7 @@ class OIDCConfig(Config): ...@@ -54,8 +54,7 @@ class OIDCConfig(Config):
"Multiple OIDC providers have the idp_id %r." % idp_id "Multiple OIDC providers have the idp_id %r." % idp_id
) )
public_baseurl = self.public_baseurl self.oidc_callback_url = self.public_baseurl + "_synapse/oidc/callback"
self.oidc_callback_url = public_baseurl + "_synapse/oidc/callback"
@property @property
def oidc_enabled(self) -> bool: def oidc_enabled(self) -> bool:
......
...@@ -99,11 +99,7 @@ class CasHandler: ...@@ -99,11 +99,7 @@ class CasHandler:
Returns: Returns:
The URL to use as a "service" parameter. The URL to use as a "service" parameter.
""" """
return "%s%s?%s" % ( return "%s?%s" % (self._cas_service_url, urllib.parse.urlencode(args),)
self._cas_service_url,
"/_matrix/client/r0/login/cas/ticket",
urllib.parse.urlencode(args),
)
async def _validate_ticket( async def _validate_ticket(
self, ticket: str, service_args: Dict[str, str] self, ticket: str, service_args: Dict[str, str]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment