flask-saml2
flask-saml2 copied to clipboard
Configure relay_state for AssertionConsumer when the SAMLResponse doesn't provide it
Depending on the SP/IDP you are working with, the request might not contain a "RelayState" parameter. I was able to set it in my project by extending the class, but it would be nice if you could set the value without doing that
I am confused - this was supposed to be fixed, right?
I get this:
Traceback (most recent call last):
File "/root/saml-test/venv/lib/python3.9/site-packages/flask/app.py", line 1498, in __call__
return self.wsgi_app(environ, start_response)
File "/root/saml-test/venv/lib/python3.9/site-packages/flask/app.py", line 1476, in wsgi_app
response = self.handle_exception(e)
File "/root/saml-test/venv/lib/python3.9/site-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
File "/root/saml-test/venv/lib/python3.9/site-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/root/saml-test/venv/lib/python3.9/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/root/saml-test/venv/lib/python3.9/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/root/saml-test/venv/lib/python3.9/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
File "/root/saml-test/venv/lib/python3.9/site-packages/flask/views.py", line 191, in dispatch_request
return current_app.ensure_sync(meth)(**kwargs) # type: ignore[no-any-return]
File "/root/saml-test/venv/lib/python3.9/site-packages/flask_saml2/sp/views.py", line 82, in post
relay_state = request.form['RelayState']
File "/root/saml-test/venv/lib/python3.9/site-packages/werkzeug/datastructures/structures.py", line 196, in __getitem__
raise exceptions.BadRequestKeyError(key)
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
KeyError: 'RelayState'
Is there anything I can do to make it work, @August-W ?