Skip to content
Snippets Groups Projects
Unverified Commit 1c8a2541 authored by Richard van der Hoff's avatar Richard van der Hoff Committed by GitHub
Browse files

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
parent f87dfb94
No related branches found
No related tags found
No related merge requests found
Fix Internal Server Error on `GET /_synapse/client/saml2/authn_response` request.
...@@ -14,24 +14,30 @@ ...@@ -14,24 +14,30 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from typing import TYPE_CHECKING
from synapse.http.server import DirectServeHtmlResource from synapse.http.server import DirectServeHtmlResource
if TYPE_CHECKING:
from synapse.server import HomeServer
class SAML2ResponseResource(DirectServeHtmlResource): class SAML2ResponseResource(DirectServeHtmlResource):
"""A Twisted web resource which handles the SAML response""" """A Twisted web resource which handles the SAML response"""
isLeaf = 1 isLeaf = 1
def __init__(self, hs): def __init__(self, hs: "HomeServer"):
super().__init__() super().__init__()
self._saml_handler = hs.get_saml_handler() self._saml_handler = hs.get_saml_handler()
self._sso_handler = hs.get_sso_handler()
async def _async_render_GET(self, request): async def _async_render_GET(self, request):
# We're not expecting any GET request on that resource if everything goes right, # 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. # 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 # In this case, just tell the user that something went wrong and they should
# try to authenticate again. # try to authenticate again.
self._saml_handler._render_error( self._sso_handler.render_error(
request, "unexpected_get", "Unexpected GET request on /saml2/authn_response" request, "unexpected_get", "Unexpected GET request on /saml2/authn_response"
) )
......
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