@@ -83,6 +83,18 @@ def startOpenID(request):
8383 required = ['dob' ])
8484 auth_request .addExtension (sreg_request )
8585
86+ # Add Attribute Exchange request information.
87+ ax_request = ax .FetchRequest ()
88+ # XXX - uses myOpenID-compatible schema values, which are
89+ # not those listed at axschema.org.
90+ ax_request .add (
91+ ax .AttrInfo ('http://schema.openid.net/namePerson' ,
92+ required = True ))
93+ ax_request .add (
94+ ax .AttrInfo ('http://schema.openid.net/contact/web/default' ,
95+ required = False , count = ax .UNLIMITED_VALUES ))
96+ auth_request .addExtension (ax_request )
97+
8698 # Add PAPE request information. We'll ask for
8799 # phishing-resistant auth and display any policies we get in
88100 # the response.
@@ -150,9 +162,18 @@ def finishOpenID(request):
150162 # Get a Simple Registration response object if response
151163 # information was included in the OpenID response.
152164 sreg_response = {}
165+ ax_items = {}
153166 if response .status == consumer .SUCCESS :
154167 sreg_response = sreg .SRegResponse .fromSuccessResponse (response )
155168
169+ ax_response = ax .FetchResponse .fromSuccessResponse (response )
170+ ax_items = {
171+ 'fullname' : ax_response .get (
172+ 'http://schema.openid.net/namePerson' ),
173+ 'web' : ax_response .get (
174+ 'http://schema.openid.net/contact/web/default' ),
175+ }
176+
156177 # Get a PAPE response object if response information was
157178 # included in the OpenID response.
158179 pape_response = None
@@ -173,7 +194,8 @@ def finishOpenID(request):
173194 consumer .SUCCESS :
174195 {'url' : response .getDisplayIdentifier (),
175196 'sreg' : sreg_response and sreg_response .items (),
176- 'pape' : pape_response },
197+ 'ax' : ax_items .items (),
198+ 'pape' : pape_response }
177199 }
178200
179201 result = results [response .status ]
0 commit comments