Merge pull request #8870 from QuentinM-Hilbtec/saml_fix

Fix issue #8287 with blank SAML's RelayState
pull/8874/head
老广 2022-09-19 10:13:22 +08:00 committed by GitHub
commit 7f85e503d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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