fix auth, update rq dashboard

This commit is contained in:
Jordan Rodgers 2019-02-26 00:07:14 -05:00
parent b3f3670e6f
commit d9b4af0c96
3 changed files with 15 additions and 12 deletions

View file

@ -12,10 +12,10 @@ from redis import Redis
from rq_scheduler import Scheduler from rq_scheduler import Scheduler
from sqlalchemy import create_engine from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
from flask import Flask, render_template, request, redirect, session, abort from flask import Flask, render_template, request, redirect, session, abort
from proxstar.db import * from proxstar.db import *
from proxstar.vnc import * from proxstar.vnc import *
from proxstar.auth import get_auth
from proxstar.util import gen_password from proxstar.util import gen_password
from proxstar.starrs import * from proxstar.starrs import *
from proxstar.ldapdb import * from proxstar.ldapdb import *
@ -42,16 +42,7 @@ with open('proxmox_ssh_key', 'w') as key:
ssh_tunnels = [] ssh_tunnels = []
# Keep on retrying until we have auth defined since SSO sucks auth = get_auth(app)
while True:
try:
auth
break
except:
auth = OIDCAuthentication(
app,
issuer=app.config['OIDC_ISSUER'],
client_registration_info=app.config['OIDC_CLIENT_CONFIG'])
redis_conn = Redis(app.config['REDIS_HOST'], app.config['REDIS_PORT']) redis_conn = Redis(app.config['REDIS_HOST'], app.config['REDIS_PORT'])
q = Queue(connection=redis_conn) q = Queue(connection=redis_conn)

12
proxstar/auth.py Normal file
View file

@ -0,0 +1,12 @@
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
from tenacity import retry
@retry
def get_auth(app):
auth = OIDCAuthentication(
app,
issuer=app.config['OIDC_ISSUER'],
client_registration_info=app.config['OIDC_CLIENT_CONFIG'])
auth
return auth

View file

@ -11,7 +11,7 @@ raven==6.9.0
redis==2.10.6 redis==2.10.6
requests==2.20.1 requests==2.20.1
rq==0.12.0 rq==0.12.0
rq-dashboard==0.3.12 rq-dashboard==0.4.0
rq-scheduler==0.8.3 rq-scheduler==0.8.3
sqlalchemy==1.2.12 sqlalchemy==1.2.12
sshtunnel==0.1.4 sshtunnel==0.1.4