def get_auth_redirect_url(cls, identifier): s = FileOpenIDStore(cherrypy.request.app.config['appSettings']['openid.datastore_directory']) consumer = Consumer(session=cherrypy.session, store=s) authRequest = consumer.begin(identifier) return authRequest.redirectURL( realm=ApplicationPaths.get_site_root(), return_to=ApplicationPaths.get_handle_openid_auth_response_path())
def handle_auth_response(cls, query): settings = cherrypy.request.app.config['appSettings'] s = FileOpenIDStore(settings['openid.datastore_directory']) consumer = Consumer(session=cherrypy.session, store=s) response = consumer.complete( query=query, current_url=ApplicationPaths.get_handle_openid_auth_response_path()) pprint(dir(response)) print('oid status: {0}'.format(response.status)) print('oid display identifier: {0}'.format(response.getDisplayIdentifier())) print('oid identity_url: {0}'.format(response.identity_url)) #print('oid message:\n{0}'.format(response.message)) if 'success' == response.status: cherrypy.log.error('Identity URL: {0}'.format(response.identity_url)) cls.__on_success(response.identity_url) elif 'cancel' == response.status: raise cherrypy.HTTPRedirect('/error/openid?reason=cancelled') else: cherrypy.log.error('{0} {1}'.format(response.status, response.message)) raise cherrypy.HTTPRedirect('/error/openid')