From 5808d6dd88b0dccbbf58d7a37d96c6c7e9cd2ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Victor?= Date: Tue, 1 Aug 2023 09:20:54 -0300 Subject: [PATCH] fix: handle with missing param about RelayState --- social_core/backends/saml.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/social_core/backends/saml.py b/social_core/backends/saml.py index aa912f686..4e39dd25f 100644 --- a/social_core/backends/saml.py +++ b/social_core/backends/saml.py @@ -302,7 +302,11 @@ def auth_complete(self, *args, **kwargs): The user has been redirected back from the IdP and we should now log them in, if everything checks out. """ - idp_name = self.strategy.request_data()["RelayState"] + try: + idp_name = self.strategy.request_data()["RelayState"] + except KeyError: + raise AuthMissingParameter(self, "RelayState") + idp = self.get_idp(idp_name) auth = self._create_saml_auth(idp) auth.process_response()