Skip to content
Myr

persona is discontinued, remove example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #1947

authored by David Lord · committed by David Lord · parent 17d4cb3 · Browse files · 7 files+0 added−199 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+0 added−199 removed

  • other:+0 added−199 removed

7 files+0 added−199 removed

deleted:examples/persona/static/persona.js-52 removed
deleted:examples/persona/static/spinner.pngbinary

A binary file, deleted.

deleted:examples/persona/static/style.css-39 removed
deleted:examples/persona/templates/index.html-23 removed
deleted:examples/persona/templates/layout.html-27 removed
deleted:examples/persona/persona.py-55 removed
1from flask import Flask, render_template, session, request, abort, g23import requests456app = Flask(__name__)7app.config.update(8 DEBUG=True,9 SECRET_KEY='my development key',10 PERSONA_JS='https://login.persona.org/include.js',11 PERSONA_VERIFIER='https://verifier.login.persona.org/verify',12)13app.config.from_envvar('PERSONA_SETTINGS', silent=True)141516@app.before_request17def get_current_user():18 g.user = None19 email = session.get('email')20 if email is not None:21 g.user = email222324@app.route('/')25def index():26 """Just a generic index page to show."""27 return render_template('index.html')282930@app.route('/_auth/login', methods=['GET', 'POST'])31def login_handler():32 """This is used by the persona.js file to kick off the33 verification securely from the server side. If all is okay34 the email address is remembered on the server.35 """36 resp = requests.post(app.config['PERSONA_VERIFIER'], data={37 'assertion': request.form['assertion'],38 'audience': request.host_url,39 }, verify=True)40 if resp.ok:41 verification_data = resp.json()42 if verification_data['status'] == 'okay':43 session['email'] = verification_data['email']44 return 'OK'4546 abort(400)474849@app.route('/_auth/logout', methods=['POST'])50def logout_handler():51 """This is what persona.js will call to sign the user52 out again.53 """54 session.clear()55 return 'OK'
deleted:examples/persona/README.md-3 removed