~django-openid-auth/django-openid-auth/trunk

« back to all changes in this revision

Viewing changes to django_openidconsumer/middleware.py

  • Committer: swillison
  • Date: 2007-04-15 19:20:10 UTC
  • Revision ID: svn-v3-trunk0:3bcd880a-622a-0410-974b-89bbab7935c3:trunk:9
Initial checkin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
class OpenIDMiddleware(object):
 
2
    """
 
3
    Populate request.openid and request.openids with their openid. This comes 
 
4
    eithen from their cookie or from their session, depending on the presence 
 
5
    of OPENID_USE_SESSIONS.
 
6
    """
 
7
    def process_request(self, request):
 
8
        request.openids = request.session.get('openids', [])
 
9
        if request.openids:
 
10
            request.openid = request.openids[-1] # Last authenticated OpenID
 
11
        else:
 
12
            request.openid = None