Folks, I need help to figure out what is going on with my redash SAML configuration. We use google as our identity provider and since they don’t provide an endpoint to serve their metadata URL. I basically downloaded the IDP metadata and spun a link in my nginx container pointing to the file in my case index.xml. but i keep seeing a parse error “not well formed invalid token” in the logs when i try to sign in using SAML. Can anyone please help with what i might be doing wrong. I am running a V 8.0.0.b32245 on docker

image

here are the server logs:

[2020-06-12 17:02:31,516][PID:12][DEBUG][saml2.httpbase] Response status: 200
[2020-06-12 17:02:31,518] ERROR in app: Exception on /saml/login [GET]
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1982, in wsgi_app
response = self.full_dispatch_request()
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/local/lib/python2.7/site-packages/flask_restful/init.py”, line 271, in error_router
return original_handler(e)
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1612, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python2.7/site-packages/flask/app.py”, line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File “/app/redash/authentication/saml_auth.py”, line 106, in sp_initiated
saml_client = get_saml_client(current_org)
File “/app/redash/authentication/saml_auth.py”, line 56, in get_saml_client
sp_config.load(saml_settings)
File “/usr/local/lib/python2.7/site-packages/saml2/config.py”, line 356, in load
self.load_complex(cnf, metadata_construction=metadata_construction)
File “/usr/local/lib/python2.7/site-packages/saml2/config.py”, line 296, in load_complex
self.load_metadata(cnf[“metadata”]))
File “/usr/local/lib/python2.7/site-packages/saml2/config.py”, line 400, in load_metadata
mds.imp(metadata_conf)
File “/usr/local/lib/python2.7/site-packages/saml2/mdstore.py”, line 922, in imp
self.load(key, **val)
File “/usr/local/lib/python2.7/site-packages/saml2/mdstore.py”, line 910, in load
_md.load()
File “/usr/local/lib/python2.7/site-packages/saml2/mdstore.py”, line 754, in load
return self.parse_and_check_signature(_txt)
File “/usr/local/lib/python2.7/site-packages/saml2/mdstore.py”, line 635, in parse_and_check_signature
self.parse(txt)
File “/usr/local/lib/python2.7/site-packages/saml2/mdstore.py”, line 522, in parse
self.entities_descr = md.entities_descriptor_from_string(xmlstr)
File “/usr/local/lib/python2.7/site-packages/saml2/md.py”, line 1859, in entities_descriptor_from_string
return saml2.create_class_from_xml_string(EntitiesDescriptor, xml_string)
File “/usr/local/lib/python2.7/site-packages/saml2/init.py”, line 91, in create_class_from_xml_string
tree = defusedxml.ElementTree.fromstring(xml_string)
File “/usr/local/lib/python2.7/site-packages/defusedxml/common.py”, line 131, in fromstring
parser.feed(text)
File “/usr/local/lib/python2.7/xml/etree/ElementTree.py”, line 1659, in feed
self._raiseerror(v)
File “/usr/local/lib/python2.7/xml/etree/ElementTree.py”, line 1523, in _raiseerror
raise err
ParseError: not well-formed (invalid token): line 3, column 1

Have you checked index.xml with an XML parser to see if it’s valid?

thank you for that. that actually pointed to where my issue is which was white spaces in my xml file as a result of directly copying from my text editor.

1 Like