Logic fix, README additions
This commit is contained in:
parent
b86eb15bde
commit
baae6e097c
|
@ -6,6 +6,7 @@ Dropper is an uploading/downloading application to push and pull data from devic
|
||||||
* Set the fields in static/google-api-data.json file to use the google drive picker api.
|
* Set the fields in static/google-api-data.json file to use the google drive picker api.
|
||||||
* You will need Keycloak setup to use this application.
|
* You will need Keycloak setup to use this application.
|
||||||
* DNS over HTTPS can affect hosts file usage so make sure to disable that if using Firefox and editing hosts file.
|
* DNS over HTTPS can affect hosts file usage so make sure to disable that if using Firefox and editing hosts file.
|
||||||
|
* If using HTTPS, you will need to add your certificate information to httplib2's (located in your venv folder under site-packages) 'cacerts.txt' file. Otherwise, you'll get "itsdangerous.exc.BadSignature:" error trying to login or out.
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
You will need Keycloak setup to use this application. The file 'client_secrets.json' has the predefined structure setup so you can use it for reference- modify accordingly. If you use the same realms and clients in Keycloak, you'll still need to change the 'client_secret' key; the one shown is an example of what you need to get from Keycloak (CHANGE and KEEP this SECRET if using on a public facing site!). In addition, use the hosts file on your computer to setup redirects for 'www.ssoapps.com' (Keycloak) and 'www.dropper.com' (Dropper App).
|
You will need Keycloak setup to use this application. The file 'client_secrets.json' has the predefined structure setup so you can use it for reference- modify accordingly. If you use the same realms and clients in Keycloak, you'll still need to change the 'client_secret' key; the one shown is an example of what you need to get from Keycloak (CHANGE and KEEP this SECRET if using on a public facing site!). In addition, use the hosts file on your computer to setup redirects for 'www.ssoapps.com' (Keycloak) and 'www.dropper.com' (Dropper App).
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
from . import Routes
|
from . import Routes
|
||||||
|
from .pages import Login
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Python imports
|
||||||
|
|
||||||
|
# Lib imports
|
||||||
|
from flask import request, render_template, flash, redirect, url_for
|
||||||
|
|
||||||
|
# App imports
|
||||||
|
from ... import app, oidc
|
||||||
|
from ...utils import MessageHandler # Get simple message processor
|
||||||
|
|
||||||
|
|
||||||
|
msgHandler = MessageHandler()
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
|
@oidc.require_login
|
||||||
|
def login():
|
||||||
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/logout', methods=['GET', 'POST'])
|
||||||
|
@oidc.require_login
|
||||||
|
def 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'])
|
|
@ -1,2 +1 @@
|
||||||
[
|
[]
|
||||||
]
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# set -o xtrace ## To debug scripts
|
||||||
|
# set -o errexit ## To exit on error
|
||||||
|
# set -o errunset ## To exit if a variable is referenced but not set
|
||||||
|
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
|
cd "${SCRIPTPATH}"
|
||||||
|
echo "Working Dir: " $(pwd)
|
||||||
|
mkdir /tmp/apps
|
||||||
|
source "../venv/bin/activate"
|
||||||
|
gunicorn --bind unix:/tmp/apps/dropper.sock wsgi:app -p app.pid
|
||||||
|
}
|
||||||
|
main $@;
|
Loading…
Reference in New Issue