Tuesday, March 25, 2014

Debugging djangosaml2

I'm using the djangosaml2 app to add the Single Sign On functionality using SAML2 to my Django projects. I followed the official manual at https://bitbucket.org/lgs/djangosaml2/overview to make my project work with a SimpleSAMLphp instance as an IdP but I got this error:

cannot serialize IdpUnspecified('No IdP to send to given the premises',) (type IdpUnspecified)

I have no idea why this error showed up?! I have a very little knowledge about SAML2 and the PySAML2 module. The only thing I can think about is to enable logging for the djangosaml2 app. So, I added these following lines in the settings.py of my project:

import logging

I reloaded the website and a logging message appeared in the console:

ERROR:djangosaml2:Unable to know which IdP to use

Yessss, that is the problem!