#NEWLINE# def _on_authentication_verified( self , callback , response ) : #NEWLINE# #INDENT# if ( response . error or ( 'is_valid:true' not in response . body ) ) : #NEWLINE# #INDENT# logging . warning ( 'Invalid OpenID response: %s' , ( response . error or response . body ) ) #NEWLINE# callback ( None ) #NEWLINE# return #NEWLINE# #UNINDENT# ax_ns = None #NEWLINE# for ( name , values ) in self . request . arguments . iteritems ( ) : #NEWLINE# #INDENT# if ( name . startswith ( 'openid.ns.' ) and ( values [ ( - 1 ) ] == 'http://openid.net/srv/ax/1.0' ) ) : #NEWLINE# #INDENT# ax_ns = name [ 10 : ] #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# def get_ax_arg( uri ) : #NEWLINE# #INDENT# if ( not ax_ns ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# prefix = ( ( 'openid.' + ax_ns ) + '.type.' ) #NEWLINE# ax_name = None #NEWLINE# for ( name , values ) in self . request . arguments . iteritems ( ) : #NEWLINE# #INDENT# if ( ( values [ ( - 1 ) ] == uri ) and name . startswith ( prefix ) ) : #NEWLINE# #INDENT# part = name [ len ( prefix ) : ] #NEWLINE# ax_name = ( ( ( 'openid.' + ax_ns ) + '.value.' ) + part ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( not ax_name ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# return self . get_argument ( ax_name , '' ) #NEWLINE# #UNINDENT# claimed_id = self . get_argument ( 'openid.claimed_id' , None ) #NEWLINE# email = get_ax_arg ( 'http://axschema.org/contact/email' ) #NEWLINE# name = get_ax_arg ( 'http://axschema.org/namePerson' ) #NEWLINE# first_name = get_ax_arg ( 'http://axschema.org/namePerson/first' ) #NEWLINE# last_name = get_ax_arg ( 'http://axschema.org/namePerson/last' ) #NEWLINE# username = get_ax_arg ( 'http://axschema.org/namePerson/friendly' ) #NEWLINE# locale = get_ax_arg ( 'http://axschema.org/pref/language' ) . lower ( ) #NEWLINE# user = dict ( ) #NEWLINE# name_parts = [ ] #NEWLINE# if first_name : #NEWLINE# #INDENT# user [ 'first_name' ] = first_name #NEWLINE# name_parts . append ( first_name ) #NEWLINE# #UNINDENT# if get_ax_arg : #NEWLINE# #INDENT# user [ 'last_name' ] = last_name #NEWLINE# name_parts . append ( last_name ) #NEWLINE# #UNINDENT# if name : #NEWLINE# #INDENT# user [ 'name' ] = name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if name_parts : #NEWLINE# #INDENT# user [ 'name' ] = ' ' . join ( name_parts ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if email : #NEWLINE# #INDENT# user [ 'name' ] = email . split ( '@' ) [ 0 ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if email : #NEWLINE# #INDENT# user [ 'email' ] = email #NEWLINE# #UNINDENT# if locale : #NEWLINE# #INDENT# user [ 'locale' ] = locale #NEWLINE# #UNINDENT# if username : #NEWLINE# #INDENT# user [ 'username' ] = username #NEWLINE# #UNINDENT# if claimed_id : #NEWLINE# #INDENT# user [ 'claimed_id' ] = claimed_id #NEWLINE# #UNINDENT# callback ( user )