Allow subpaths in MAS endpoints (#19186)
Fixes #19184 ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [X] Pull request is based on the develop branch * [X] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [X] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
This commit is contained in:
@@ -1057,6 +1057,32 @@ class MasAuthDelegation(HomeserverTestCase):
|
||||
self.assertEqual(self.server.calls, 1)
|
||||
|
||||
|
||||
class MasAuthDelegationWithSubpath(MasAuthDelegation):
|
||||
"""Test MAS delegation when the MAS server is hosted on a subpath."""
|
||||
|
||||
def default_config(self) -> dict[str, Any]:
|
||||
config = super().default_config()
|
||||
# Override the endpoint to include a subpath
|
||||
config["matrix_authentication_service"]["endpoint"] = (
|
||||
self.server.endpoint + "auth/path/"
|
||||
)
|
||||
return config
|
||||
|
||||
def test_introspection_endpoint_uses_subpath(self) -> None:
|
||||
"""Test that the introspection endpoint correctly uses the configured subpath."""
|
||||
expected_introspection_url = (
|
||||
self.server.endpoint + "auth/path/oauth2/introspect"
|
||||
)
|
||||
self.assertEqual(self._auth._introspection_endpoint, expected_introspection_url)
|
||||
|
||||
def test_metadata_url_uses_subpath(self) -> None:
|
||||
"""Test that the metadata URL correctly uses the configured subpath."""
|
||||
expected_metadata_url = (
|
||||
self.server.endpoint + "auth/path/.well-known/openid-configuration"
|
||||
)
|
||||
self.assertEqual(self._auth._metadata_url, expected_metadata_url)
|
||||
|
||||
|
||||
@parameterized_class(
|
||||
("config",),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user