Browse Source

Logic fix, README additions

master
maximstewart 2 months ago
parent
commit
baae6e097c
6 changed files with 48 additions and 2 deletions
  1. +1
    -0
      README.md
  2. +1
    -0
      src/dropper/routes/__init__.py
  3. +29
    -0
      src/dropper/routes/pages/Login.py
  4. +1
    -2
      src/dropper/static/NOTES.txt
  5. +0
    -0
      src/linux-start.sh
  6. +16
    -0
      src/socket_run.sh

+ 1
- 0
README.md View File

@ -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.
* 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.
* 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
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
- 0
src/dropper/routes/__init__.py View File

@ -1 +1,2 @@
from . import Routes
from .pages import Login

+ 29
- 0
src/dropper/routes/pages/Login.py View File

@ -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
src/dropper/static/NOTES.txt View File

@ -1,2 +1 @@
[
]
[]

src/start.sh → src/linux-start.sh View File


+ 16
- 0
src/socket_run.sh View File

@ -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 [email protected];

Loading…
Cancel
Save