Esempio n. 1
0
 def getsession(self, environ):
     '''Return the existing session or a new session'''
     # Get value of cookie header that was sent
     sid = self.getsid(environ)
     # If a session id was not set, create a new one
     if sid is None:
         sid = randomString(16, '0123456789abcdef')
         session = None
     else:
         session = self.tracker.get(sid)
     # If no session exists for this session ID, create one
     if session is None:
         session = self.tracker[sid] = {}
         session['redirect'] = geturl(environ)
     session['id'] = sid        
     return session
Esempio n. 2
0
 def __call__(self, environ):
     # Base URL
     environ['openid.baseurl'] = geturl(environ, False, False)
     # Query string
     environ['openid.query'] = dict(cgi.parse_qsl(environ['QUERY_STRING']))
     # Path
     path = getpath(environ)
     # Start verification
     if path == '/verify':
         return self.verify(environ)
     # Process response
     elif path == '/process':
         return self.process(environ)
     # Prompt for URL
     else:            
         message = 'Enter an OpenID Identifier to verify.'
         return self.response(message, environ)
Esempio n. 3
0
 def initial(self, environ, start_response):
     # Embed auth token
     self.generate(environ)
     # Redirect to requested URL with auth token in query string
     redirect = self.redirect(geturl(environ))
     return redirect(environ, start_response)