IDP example missing POST response encoding
See original GitHub issueCode Version
hash 1aeae3a
Expected Behavior
When running the idp.py test, SAMLResponse should be parseable, and it’s coming through as bytes, not a string, so the string lookup can’t find it and it fails…
IDP listening on 0.0.0.0:8088 KeyError('SAMLRequest') Traceback (most recent call last): File "./idp.py", line 452, in post _key = saml_msg["key"] KeyError: 'key'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/venv.test/lib/python3.8/site-packages/cheroot/server.py", line 1283, in communicate req.respond() File "/home/ubuntu/venv.test/lib/python3.8/site-packages/cheroot/server.py", line 1073, in respond self.server.gateway(self).respond() File "/home/ubuntu/venv.test/lib/python3.8/site-packages/cheroot/wsgi.py", line 140, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "./idp.py", line 1077, in application
return func()
File "./idp.py", line 458, in post
saml_msg["SAMLRequest"], BINDING_HTTP_POST
KeyError: 'SAMLRequest'
^C^CTraceback (most recent call last):
File "./idp.py", line 1159, in <module>
SRV.start()
File "/home/ubuntu/venv.test/lib/python3.8/site-packages/cheroot/server.py", line 1819, in start
self.serve()
File "/home/ubuntu/venv.test/lib/python3.8/site-packages/cheroot/server.py", line 1798, in serve
self.tick()
File "/home/ubuntu/venv.test/lib/python3.8/site-packages/cheroot/server.py", line 2038, in tick
conn = self._connections.get_conn()
File "/home/ubuntu/venv.test/lib/python3.8/site-packages/cheroot/connections.py", line 137, in get_conn
in self._selector.select(timeout=0.01)
File "/home/ubuntu/.pyenv/versions/3.8.5/lib/python3.8/selectors.py", line 468, in select
fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
Current Behavior
The received data is not encoded back to a string and they response key lookup fails.
Possible Solution
in idp.py:
def unpack_post(self):
_dict = parse_qs(get_post(self.environ))
becomes
_dict = parse_qs(get_post(self.environ).decode('utf-8'))
Steps to Reproduce
- Used default idp_conf.py and idp settings with minimal reconfiguration. Using AWS SSO as SP.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
[Shib-Users] Idp not posting saml response back to SP
The decoding error is due to the fact the IDP is redirecting to itself (which I am not sure why this occurring). The...
Read more >SAML message delivered with POST to incorrect server URL.
The IdP is using the wrong entityID and mistakenly trying to spoof another IdP. Unable to establish security of incoming assertion. This error ......
Read more >SAML Response Examples | SAMLTool.com
SAML Response (IdP -> SP). This example contains several SAML Responses. A SAML Response is sent by the Identity Provider to the Service...
Read more >Problems with logging in with SAML | Jira
IDP -initiated SSO using POST Binding to transfer the <Response> message from an ... in the base64 encoding in the <samlp:Response> element.
Read more >Identity Providers API - Okta Developer
If the post is base64 encoded, set the Content-Transfer-Encoding header to base64 . Response parameters. Returns the new signing Key Credential. Request example....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed by d62a10c473f64e389d2d26958c83c83daafe38fd
Yes, fill free to make your fork and do a PR for this. Please create a separate branch and others and any that @c00kiemon5ter can tell us