Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jouellnyc committed May 14, 2022
1 parent aa7149f commit 7c5f015
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions stock_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import flask
from flask import g
from flask import Flask
from flask import session
from flask import request
from flask import redirect
from flask import render_template
Expand Down Expand Up @@ -50,19 +51,33 @@

})


if __name__ != "__main__":
gunicorn_logger = logging.getLogger("gunicorn.error")
app.logger.handlers = gunicorn_logger.handlers
app.logger.setLevel(gunicorn_logger.level)

oidc = OpenIDConnect(app)

@app.before_request
def before_request_func():
if 'user' in session:
if not g.oidc_id_token and 'oidc_id_token' in session:
g.oidc_id_token = session["oidc_id_token"]
else:
session['oidc_id_token'] = g.oidc_id_token

@app.route('/')
def hello_world():
if oidc.user_loggedin:
email=oidc.user_getfield('email')
email=oidc.user_getfield('given_name')
print("email:",email)
print('oidc-',dir(oidc))
print('g-',dir(g.oidc_id_token))
print('g--',dir(g))
print('g---',g.oidc_id_token)
print('app-',dir(app))
#return ('Hello, %s, <a href="/private">See private</a> '
# '<a href="/logout">Log out</a>') % \
# oidc.user_getfield('email')
Expand Down

0 comments on commit 7c5f015

Please sign in to comment.