<s> import json <EOL> from pyramid . config import Configurator <EOL> from pyramid . session import UnencryptedCookieSessionFactoryConfig <EOL> from pyramid . view import view_config <EOL> from velruse import login_url <EOL> @ view_config ( <EOL> name = '<STR_LIT>' , <EOL> request_method = '<STR_LIT:GET>' , <EOL> renderer = '<STR_LIT>' . format ( __name__ ) , <EOL> ) <EOL> def login_view ( request ) : <EOL> return { <EOL> '<STR_LIT>' : lambda name : login_url ( request , name ) , <EOL> '<STR_LIT>' : request . registry . settings [ '<STR_LIT>' ] , <EOL> } <EOL> @ view_config ( <EOL> context = '<STR_LIT>' , <EOL> renderer = '<STR_LIT>' . format ( __name__ ) , <EOL> ) <EOL> def login_complete_view ( request ) : <EOL> context = request . context <EOL> result = { <EOL> '<STR_LIT>' : context . profile , <EOL> '<STR_LIT>' : context . credentials , <EOL> } <EOL> return { <EOL> '<STR_LIT:result>' : json . dumps ( result , indent = <NUM_LIT:4> ) , <EOL> } <EOL> @ view_config ( <EOL> context = '<STR_LIT>' , <EOL> renderer = '<STR_LIT>' . format ( __name__ ) , <EOL> ) <EOL> def login_denied_view ( request ) : <EOL> return { <EOL> '<STR_LIT:result>' : '<STR_LIT>' , <EOL> } <EOL> def main ( global_conf , ** settings ) : <EOL> session_factory = UnencryptedCookieSessionFactoryConfig ( '<STR_LIT>' ) <EOL> providers = settings . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> providers = filter ( None , [ p . strip ( ) <EOL> for line in providers . splitlines ( ) <EOL> for p in line . split ( '<STR_LIT:U+002CU+0020>' ) ] ) <EOL> settings [ '<STR_LIT>' ] = providers <EOL> config = Configurator ( settings = settings ) <EOL> config . set_session_factory ( session_factory ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_facebook_login ( <EOL> settings [ '<STR_LIT>' ] , <EOL> settings [ '<STR_LIT>' ] , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_github_login ( <EOL> settings [ '<STR_LIT>' ] , <EOL> settings [ '<STR_LIT>' ] , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_twitter_login ( <EOL> settings [ '<STR_LIT>' ] , <EOL> settings [ '<STR_LIT>' ] , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_live_login ( <EOL> settings [ '<STR_LIT>' ] , <EOL> settings [ '<STR_LIT>' ] , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_bitbucket_login ( <EOL> settings [ '<STR_LIT>' ] , <EOL> settings [ '<STR_LIT>' ] , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_google_hybrid_login ( <EOL> realm = settings [ '<STR_LIT>' ] , <EOL> consumer_key = settings [ '<STR_LIT>' ] , <EOL> consumer_secret = settings [ '<STR_LIT>' ] , <EOL> scope = settings . get ( '<STR_LIT>' ) , <EOL> login_path = '<STR_LIT>' , <EOL> callback_path = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_google_oauth2_login ( <EOL> consumer_key = settings [ '<STR_LIT>' ] , <EOL> consumer_secret = settings [ '<STR_LIT>' ] , <EOL> scope = settings . get ( '<STR_LIT>' ) , <EOL> login_path = '<STR_LIT>' , <EOL> callback_path = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_openid_login ( <EOL> realm = settings [ '<STR_LIT>' ] , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_yahoo_login ( <EOL> realm = settings [ '<STR_LIT>' ] , <EOL> consumer_key = settings [ '<STR_LIT>' ] , <EOL> consumer_secret = settings [ '<STR_LIT>' ] , <EOL> ) <EOL> if '<STR_LIT>' in providers : <EOL> config . include ( '<STR_LIT>' ) <EOL> config . add_linkedin_login ( <EOL> settings [ '<STR_LIT>' ] , <EOL> settings [ '<STR_LIT>' ] , <EOL> ) <EOL> config . scan ( __name__ ) <EOL> return config . make_wsgi_app ( ) </s>
