changeset 36:afeb01315ab6

example/persona.py
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 27 Dec 2013 13:49:48 -0800
parents d95ac066cb62
children 6b5946843928
files example/persona.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/example/persona.py
+++ b/example/persona.py
@@ -1,16 +1,17 @@
 #!/usr/bin/env python
 
 """
 test Mozilla persona auth
 
 https://login.persona.org/about
 """
 
+import browserid
 import optparse
 import os
 import sys
 from webob import Request, Response, exc
 from wsgiref import simple_server
 
 here = os.path.dirname(os.path.realpath(__file__))
 page = os.path.join(here, 'persona.html')
@@ -23,16 +24,18 @@ class PersonaTest(object):
     def __call__(self, environ, start_response):
         request = Request(environ)
         method = request.method
         if method == 'GET':
             content_type = 'text/html'
             body = self.page
         elif method == 'POST':
             content_type = 'text/plain'
+            assertion = request.POST.get('assertion')
+            print ("Assertion: %s" % assertion)
             body = '\n'.join(['%s: %s' % (key, environ[key])
                               for key in sorted(environ.keys())])
         else:
             content_type = 'text/plain'
             body = 'Try GET or POST to do something interesting (How did you get here?)'
         start_response("200 OK", [('Content-Type', content_type),
                                   ('Content-Length', str(len(body)))])
         return [body]