I have a type of user that is logged in to the site in a way
externally (SAML2-module for apache) to django (newest newforms-admin
branch). This external login-process leaves a token in the
environment-variables: while the token is in the envvars, the user is
logged in. (I hope to write a SAML2 module in pure python later this
year...) I have written an auth-backend to pick up and process this
token, that part works fine. The problem lies, however, in triggering
the authentication from the django side (and build a django-native
User-object if necesary.) I cannot test the auth-backend with
runserver since the token is built dynamically each time by apache, so
I'm using mod_wsgi (mod_python was just too frustrating!).

Now, my test-view calls authenticate() and then login() but I always
wind up with a 500 error. Even with loglevel set to debug, the
error-message/traceback in the apache error.log isn't very helpful.
Reproduced below, with the SSL-noise and most of the apache-noise
removed (the stuff after "referer:" cut to make the lines shorter,
line 2 is uncut):

[info] Subsequent (No.2) HTTPS request received for child 9 (server
anonymized.com:443)
[info] mod_wsgi (pid=21355, process='',
application='anonymized.com|'): Loading WSGI script
'/home/python/django.wsgi'., referer:
https://idp.samlexample.com/amserver/SSORedirect/metaAlias/idp?ReqID=_D1B2D3FF6936D432B62D916AB48DDB33
[error]  mod_wsgi (pid=21355): Exception occurred processing WSGI
script '/home/python/django.wsgi'., referer:
[error]  Traceback (most recent call last):, referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line
209, in __call__, referer:
[error]      response = middleware_method(request, response), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/middleware.py",
line 37, in process_response, referer:
[error]      request.session.save(), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/backends/db.py",
line 42, in save, referer:
[error]      session_key = self.session_key,, referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/backends/base.py",
line 109, in _get_session_key, referer:
[error]      self._session_key = self._get_new_session_key(), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/backends/base.py",
line 101, in _get_new_session_key, referer:
[error]      if not self.exists(session_key):, referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/contrib/sessions/backends/db.py",
line 35, in exists, referer:
[error]      Session.objects.get(session_key=session_key), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/db/models/manager.py", line
69, in get, referer:
[error]      return self.get_query_set().get(*args, **kwargs), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/db/models/query.py", line
261, in get, referer:
[error]      obj_list = list(clone), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/db/models/query.py", line
114, in __iter__, referer:
[error]      return iter(self._get_data()), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/db/models/query.py", line
486, in _get_data, referer:
[error]      self._result_cache = list(self.iterator()), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/db/models/query.py", line
189, in iterator, referer:
[error]      cursor.execute("SELECT " + (self._distinct and "DISTINCT
" or "") + ",".join(select) + sql, params), referer:
[error]    File
"/usr/lib/python2.5/site-packages/django/db/backends/util.py", line
18, in execute, referer:
[error]      return self.cursor.execute(sql, params), referer:
[error]  ProgrammingError: current transaction is aborted, commands
ignored until end of transaction block, referer:
[error]  , referer:
[info]  Connection closed to child 9 with standard shutdown (server
anonymized.com:443)

(Yep. the second to last line was just a comma + referer).

Anyone seen this before? Where do I even start to look?

I'll also be needing to read an auth-token from a cookie later on,
again never going via a django-controlled login-page.


HM

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to