diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2021-03-16 10:20:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 10:20:20 +0000 |
commit | 1c8a2541dae989f7c17bff8be1e0966df4bc2363 (patch) | |
tree | 42fc1c54e203e717e8c06e6542da67babf868805 | |
parent | Revert requiring a specific version of Twisted for mypy checks. (#9618) (diff) | |
download | synapse-1c8a2541dae989f7c17bff8be1e0966df4bc2363.tar.xz |
Fix Internal Server Error on `GET /saml2/authn_response` (#9623)
* Fix Internal Server Error on `GET /saml2/authn_response` Seems to have been introduced in #8765 (Synapse 1.24.0) * Fix newsfile
-rw-r--r-- | changelog.d/9623.bugfix | 1 | ||||
-rw-r--r-- | synapse/rest/synapse/client/saml2/response_resource.py | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/changelog.d/9623.bugfix b/changelog.d/9623.bugfix new file mode 100644 index 0000000000..ecccb46105 --- /dev/null +++ b/changelog.d/9623.bugfix @@ -0,0 +1 @@ +Fix Internal Server Error on `GET /_synapse/client/saml2/authn_response` request. diff --git a/synapse/rest/synapse/client/saml2/response_resource.py b/synapse/rest/synapse/client/saml2/response_resource.py index f6668fb5e3..4dfadf1bfb 100644 --- a/synapse/rest/synapse/client/saml2/response_resource.py +++ b/synapse/rest/synapse/client/saml2/response_resource.py @@ -14,24 +14,30 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import TYPE_CHECKING + from synapse.http.server import DirectServeHtmlResource +if TYPE_CHECKING: + from synapse.server import HomeServer + class SAML2ResponseResource(DirectServeHtmlResource): """A Twisted web resource which handles the SAML response""" isLeaf = 1 - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): super().__init__() self._saml_handler = hs.get_saml_handler() + self._sso_handler = hs.get_sso_handler() async def _async_render_GET(self, request): # We're not expecting any GET request on that resource if everything goes right, # but some IdPs sometimes end up responding with a 302 redirect on this endpoint. # In this case, just tell the user that something went wrong and they should # try to authenticate again. - self._saml_handler._render_error( + self._sso_handler.render_error( request, "unexpected_get", "Unexpected GET request on /saml2/authn_response" ) |