Changeset 676
- Timestamp:
- 05/15/08 08:52:13 (7 months ago)
- Files:
-
- oss/oidtool/example.py (modified) (1 diff)
- oss/oidtool/oidtool.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
oss/oidtool/example.py
r179 r676 68 68 store = filestore.FileOpenIDStore(tempfile.gettempdir()) 69 69 70 # This is not required but we create our own CherryPy toolbox 71 # to avoid polluting the default one 72 from cherrypy._cptools import Toolbox 73 mytb = Toolbox('mytb') 74 75 # we the attach our tool instance to this toolbox 76 mytb.openid = oidtool.OpenIDTool(store, '/connect') 70 cherrypy.tools.openid = oidtool.OpenIDTool(store, '/connect') 77 71 78 72 conf = {'/': {'tools.sessions.on': True, 79 73 'tools.sessions.storage_type': 'ram', 80 ' mytb.openid.on': True}}74 'tools.openid.on': True}} 81 75 82 76 root = Root() oss/oidtool/oidtool.py
r180 r676 1 #!/usr/bin/env python2 1 # -*- coding: utf-8 -*- 3 2 4 __version__ = "0. 1"3 __version__ = "0.2" 5 4 __authors__ = ["Sylvain Hellegouarch (sh@defuze.org)"] 6 __date__ = "200 6/12/28"5 __date__ = "2008/05/15" 7 6 __copyright__ = """ 8 Copyright (c) 2006 Sylvain Hellegouarch7 Copyright (c) 2006, 2007, 2008 Sylvain Hellegouarch 9 8 All rights reserved. 10 9 """ … … 137 136 we redirect the user-agent to that url for authentication. 138 137 """ 139 140 138 # If the requested path belongs to the one defined for the 141 139 # connection handlers then we do not performany verification … … 148 146 if self.is_processing(): 149 147 return 150 148 151 149 openid_url = cherrypy.request.params.get('openid_url', None) 152 150 if not openid_url: 153 151 raise cherrypy.HTTPRedirect(self.login_path) 152 153 del cherrypy.request.params['openid_url'] 154 154 155 155 oidconsumer = consumer.Consumer(self.get_session(), self.store) … … 175 175 redirect_url = request.redirectURL(cherrypy.request.base, return_to) 176 176 177 cherrypy.session[self.session_name]['return_to'] = return_to 177 178 cherrypy.session[self.session_name]['status'] = PROCESSING 178 179 raise cherrypy.HTTPRedirect(redirect_url) … … 202 203 # either None or a string containing more information about 203 204 # the return type. 204 info = oidconsumer.complete(cherrypy.request.params) 205 info = oidconsumer.complete(cherrypy.request.params, 206 return_to=cherrypy.session[self.session_name]['return_to']) 205 207 cherrypy.session[self.session_name]['info'] = info 206 208 if info.status == consumer.FAILURE and info.identity_url:
