-
Notifications
You must be signed in to change notification settings - Fork 37
/
app.py
33 lines (22 loc) · 806 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import flask
from flask import Flask, jsonify
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
PORT = 5000
app = Flask(__name__)
app.config.update({'SERVER_NAME': 'localhost:{}'.format(PORT),
'SECRET_KEY': 'dev_key'})
auth = OIDCAuthentication(app, issuer="https://localhost:50009")
@app.route('/')
@auth.oidc_auth
def index():
return jsonify(id_token=flask.session['id_token'], access_token=flask.session['access_token'],
userinfo=flask.session['userinfo'])
@app.route('/logout')
@auth.oidc_logout
def logout():
return 'You\'ve been successfully logged out!'
@auth.error_view
def error(error=None, error_description=None):
return jsonify({'error': error, 'message': error_description})
if __name__ == '__main__':
app.run(port=PORT)