2021-02-06 04:52:46 +00:00
|
|
|
# Python imports
|
|
|
|
|
|
|
|
# Lib imports
|
|
|
|
from flask import request, redirect, flash
|
|
|
|
|
|
|
|
|
|
|
|
# App imports
|
|
|
|
from ... import app, oidc
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/oidc-login', methods=['GET', 'POST'])
|
|
|
|
@oidc.require_login
|
|
|
|
def oidc_login():
|
2021-09-04 04:51:17 +00:00
|
|
|
print(request)
|
2021-02-06 04:52:46 +00:00
|
|
|
return redirect("/")
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/oidc-logout', methods=['GET', 'POST'])
|
|
|
|
@oidc.require_login
|
|
|
|
def oidc_logout():
|
|
|
|
oidc.logout()
|
|
|
|
flash("Logged out successfully!", "success")
|
|
|
|
# NOTE: Need to redirect to logout on OIDC server to end session there too.
|
|
|
|
# If not, we can hit login url again and get same token until it expires.
|
|
|
|
return redirect( oidc.client_secrets.get('issuer')
|
|
|
|
+ '/protocol/openid-connect/logout?redirect_uri='
|
|
|
|
+ app.config['APP_REDIRECT_URI'])
|