Ticket #59: authKitOpenId.patch
-
authkit/authenticate/cookie.py
old new 372 372 environ['REMOTE_USER'] = userid 373 373 if environ.get('REMOTE_USER_TOKENS'): 374 374 # We want to add tokens/roles to what's there: 375 tokens = environ['REMOTE_USER_TOKENS'] + ',' + tokens 375 tokens = str(environ['REMOTE_USER_TOKENS']) + ',' + str(tokens) 376 376 environ['REMOTE_USER_TOKENS'] = tokens 377 377 environ['REMOTE_USER_DATA'] = user_data 378 378 environ['AUTH_TYPE'] = 'cookie' -
authkit/authenticate/multi.py
old new 40 40 log.debug("Multi: No binding was found for the check") 41 41 # XXX Shouldn't this be returning the writable to the application? 42 42 writable = start_response( 43 status_[ 0],44 headers_ and headers_[ 0] or [],45 exc_info_[ 0]43 status_[-1], 44 headers_ and headers_[-1] or [], 45 exc_info_[-1] 46 46 ) 47 47 return writable 48 48 else: … … 73 73 if not len(headers_): 74 74 raise Exception('No headers were returned by the ' 75 75 'application') 76 if checker(environ, status_[ 0], headers_ and headers_[0] or []):76 if checker(environ, status_[-1], headers_ and headers_[-1] or []): 77 77 log.debug( 78 78 "MultiMiddleware self.checker check() returning %r", 79 79 binding … … 85 85 app_iter = app(environ, start_response) 86 86 if not result_: 87 87 raise Exception('Invalid WSGI response, did the application return an iterable?') 88 if result_[ 0] is None:88 if result_[-1] is None: 89 89 # The check failed and the initial app should be used. 90 90 return app_iter 91 91 else: 92 92 # Close the unused app which we don't want 93 93 if hasattr(app_iter, 'close'): 94 94 app_iter.close() 95 return result_[ 0]95 return result_[-1] 96 96 97 97 def status_checker(environ, status, headers): 98 98 """ -
authkit/authenticate/open_id.py
old new 372 372 username = info.identity_url 373 373 if info.endpoint.canonicalID: 374 374 username = cgi.escape(info.endpoint.canonicalID) 375 user_data = str(sreg.SRegResponse.fromSuccessResponse(info).getExtensionArgs()) 375 sreg_info = sreg.SRegResponse.fromSuccessResponse(info) 376 if sreg_info: 377 user_data = str(sreg.SRegResponse.fromSuccessResponse(info).getExtensionArgs()) 378 else: 379 user_data = "" 376 380 # Set the cookie 377 381 if self.urltouser: 378 382 username = self.urltouser(environ, info.identity_url) … … 464 468 sreg_required=options['sreg_required'], 465 469 sreg_optional=options['sreg_optional'], 466 470 sreg_policyurl=options['sreg_policyurl'], 471 session_middleware=options['session_middleware'] 467 472 ) 468 473 self.app = app 469 474 … … 502 507 'sreg_required': auth_conf.get('sreg.required'), 503 508 'sreg_optional': auth_conf.get('sreg.optional'), 504 509 'sreg_policyurl': auth_conf.get('sreg.policyurl'), 505 'session_middleware': 'beaker.session',510 'session_middleware': auth_conf.get('session.middleware','beaker.session'), 506 511 } 507 512 auth_handler_params={ 508 513 'template':user_setter_params['template'], … … 510 515 'baseurl':user_setter_params['baseurl'], 511 516 'charset':user_setter_params['charset'], 512 517 } 518 authenticate_conf = strip_base(auth_conf, 'authenticate.') 519 app, authfunc, users = get_authenticate_function( 520 app, 521 authenticate_conf, 522 prefix=prefix+'authenticate.', 523 format='basic' 524 ) 513 525 return app, auth_handler_params, user_setter_params 514 526 515 527 def make_passurl_handler(
