diff --git a/apps/authentication/backends/saml2/views.py b/apps/authentication/backends/saml2/views.py index 9bc3ddc97..e0fa97590 100644 --- a/apps/authentication/backends/saml2/views.py +++ b/apps/authentication/backends/saml2/views.py @@ -271,7 +271,10 @@ class Saml2AuthCallbackView(View, PrepareRequestMixin): auth.login(self.request, user) logger.debug(log_prompt.format('Redirect')) - next_url = saml_instance.redirect_to(post_data.get('RelayState', '/')) + redir = post_data.get('RelayState') + if not redir or len(redir) == 0: + redir = "/" + next_url = saml_instance.redirect_to(redir) return HttpResponseRedirect(next_url) @csrf_exempt