Skip to content

Commit ecd4127

Browse files
authored
Revert "Upgrading to pyoidc 3.7.0" (#78)
1 parent a58a23c commit ecd4127

File tree

3 files changed

+28
-33
lines changed

3 files changed

+28
-33
lines changed

proxstar/__init__.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128

129129
def add_rq_dashboard_auth(blueprint):
130130
@blueprint.before_request
131-
@auth.oidc_auth('sso')
131+
@auth.oidc_auth
132132
def rq_dashboard_auth(*args, **kwargs): # pylint: disable=unused-argument,unused-variable
133133
if 'rtp' not in session['userinfo']['groups']:
134134
abort(403)
@@ -153,7 +153,7 @@ def forbidden(e):
153153

154154
@app.route('/')
155155
@app.route('/user/<string:user_view>')
156-
@auth.oidc_auth('sso')
156+
@auth.oidc_auth
157157
def list_vms(user_view=None):
158158
user = User(session['userinfo']['preferred_username'])
159159
rtp_view = False
@@ -190,15 +190,15 @@ def list_vms(user_view=None):
190190

191191

192192
@app.route('/isos')
193-
@auth.oidc_auth('sso')
193+
@auth.oidc_auth
194194
def isos():
195195
proxmox = connect_proxmox()
196196
stored_isos = get_isos(proxmox, app.config['PROXMOX_ISO_STORAGE'])
197197
return json.dumps({'isos': stored_isos})
198198

199199

200200
@app.route('/hostname/<string:name>')
201-
@auth.oidc_auth('sso')
201+
@auth.oidc_auth
202202
def hostname(name):
203203
valid, available = check_hostname(starrs, name)
204204
if not valid:
@@ -210,7 +210,7 @@ def hostname(name):
210210

211211

212212
@app.route('/vm/<string:vmid>')
213-
@auth.oidc_auth('sso')
213+
@auth.oidc_auth
214214
def vm_details(vmid):
215215
user = User(session['userinfo']['preferred_username'])
216216
connect_proxmox()
@@ -230,7 +230,7 @@ def vm_details(vmid):
230230

231231

232232
@app.route('/vm/<string:vmid>/power/<string:action>', methods=['POST'])
233-
@auth.oidc_auth('sso')
233+
@auth.oidc_auth
234234
def vm_power(vmid, action):
235235
user = User(session['userinfo']['preferred_username'])
236236
connect_proxmox()
@@ -270,7 +270,7 @@ def vm_console_stop(vmid):
270270

271271

272272
@app.route('/console/vm/<string:vmid>', methods=['POST'])
273-
@auth.oidc_auth('sso')
273+
@auth.oidc_auth
274274
def vm_console(vmid):
275275
user = User(session['userinfo']['preferred_username'])
276276
connect_proxmox()
@@ -290,7 +290,7 @@ def vm_console(vmid):
290290

291291

292292
@app.route('/vm/<string:vmid>/cpu/<int:cores>', methods=['POST'])
293-
@auth.oidc_auth('sso')
293+
@auth.oidc_auth
294294
def vm_cpu(vmid, cores):
295295
user = User(session['userinfo']['preferred_username'])
296296
connect_proxmox()
@@ -311,7 +311,7 @@ def vm_cpu(vmid, cores):
311311

312312

313313
@app.route('/vm/<string:vmid>/mem/<int:mem>', methods=['POST'])
314-
@auth.oidc_auth('sso')
314+
@auth.oidc_auth
315315
def vm_mem(vmid, mem):
316316
user = User(session['userinfo']['preferred_username'])
317317
connect_proxmox()
@@ -332,7 +332,7 @@ def vm_mem(vmid, mem):
332332

333333

334334
@app.route('/vm/<string:vmid>/disk/<string:disk>/<int:size>', methods=['POST'])
335-
@auth.oidc_auth('sso')
335+
@auth.oidc_auth
336336
def vm_disk(vmid, disk, size):
337337
user = User(session['userinfo']['preferred_username'])
338338
connect_proxmox()
@@ -348,7 +348,7 @@ def vm_disk(vmid, disk, size):
348348

349349

350350
@app.route('/vm/<string:vmid>/renew', methods=['POST'])
351-
@auth.oidc_auth('sso')
351+
@auth.oidc_auth
352352
def vm_renew(vmid):
353353
user = User(session['userinfo']['preferred_username'])
354354
connect_proxmox()
@@ -364,7 +364,7 @@ def vm_renew(vmid):
364364

365365

366366
@app.route('/vm/<string:vmid>/eject', methods=['POST'])
367-
@auth.oidc_auth('sso')
367+
@auth.oidc_auth
368368
def iso_eject(vmid):
369369
user = User(session['userinfo']['preferred_username'])
370370
connect_proxmox()
@@ -377,7 +377,7 @@ def iso_eject(vmid):
377377

378378

379379
@app.route('/vm/<string:vmid>/mount/<string:iso>', methods=['POST'])
380-
@auth.oidc_auth('sso')
380+
@auth.oidc_auth
381381
def iso_mount(vmid, iso):
382382
user = User(session['userinfo']['preferred_username'])
383383
connect_proxmox()
@@ -391,7 +391,7 @@ def iso_mount(vmid, iso):
391391

392392

393393
@app.route('/vm/<string:vmid>/delete', methods=['POST'])
394-
@auth.oidc_auth('sso')
394+
@auth.oidc_auth
395395
def delete(vmid):
396396
user = User(session['userinfo']['preferred_username'])
397397
connect_proxmox()
@@ -405,7 +405,7 @@ def delete(vmid):
405405

406406

407407
@app.route('/vm/<string:vmid>/boot_order', methods=['POST'])
408-
@auth.oidc_auth('sso')
408+
@auth.oidc_auth
409409
def get_boot_order(vmid):
410410
user = User(session['userinfo']['preferred_username'])
411411
connect_proxmox()
@@ -421,7 +421,7 @@ def get_boot_order(vmid):
421421

422422

423423
@app.route('/vm/create', methods=['GET', 'POST'])
424-
@auth.oidc_auth('sso')
424+
@auth.oidc_auth
425425
def create():
426426
user = User(session['userinfo']['preferred_username'])
427427
proxmox = connect_proxmox()
@@ -494,7 +494,7 @@ def create():
494494

495495

496496
@app.route('/limits/<string:user>', methods=['POST'])
497-
@auth.oidc_auth('sso')
497+
@auth.oidc_auth
498498
def set_limits(user):
499499
if 'rtp' in session['userinfo']['groups']:
500500
cpu = request.form['cpu']
@@ -507,7 +507,7 @@ def set_limits(user):
507507

508508

509509
@app.route('/user/<string:user>/delete', methods=['POST'])
510-
@auth.oidc_auth('sso')
510+
@auth.oidc_auth
511511
def delete_user(user):
512512
if 'rtp' in session['userinfo']['groups']:
513513
connect_proxmox()
@@ -518,7 +518,7 @@ def delete_user(user):
518518

519519

520520
@app.route('/settings')
521-
@auth.oidc_auth('sso')
521+
@auth.oidc_auth
522522
def settings():
523523
user = User(session['userinfo']['preferred_username'])
524524
if user.rtp:
@@ -537,7 +537,7 @@ def settings():
537537

538538

539539
@app.route('/pool/<string:pool>/ignore', methods=['POST', 'DELETE'])
540-
@auth.oidc_auth('sso')
540+
@auth.oidc_auth
541541
def ignored_pools(pool):
542542
if 'rtp' in session['userinfo']['groups']:
543543
if request.method == 'POST':
@@ -550,7 +550,7 @@ def ignored_pools(pool):
550550

551551

552552
@app.route('/user/<string:user>/allow', methods=['POST', 'DELETE'])
553-
@auth.oidc_auth('sso')
553+
@auth.oidc_auth
554554
def allowed_users(user):
555555
if 'rtp' in session['userinfo']['groups']:
556556
if request.method == 'POST':
@@ -591,15 +591,15 @@ def cleanup_vnc():
591591

592592

593593
@app.route('/template/<string:template_id>/disk')
594-
@auth.oidc_auth('sso')
594+
@auth.oidc_auth
595595
def template_disk(template_id):
596596
if template_id == 'none':
597597
return '0'
598598
return get_template_disk(db, template_id)
599599

600600

601601
@app.route('/template/<string:template_id>/edit', methods=['POST'])
602-
@auth.oidc_auth('sso')
602+
@auth.oidc_auth
603603
def template_edit(template_id):
604604
if 'rtp' in session['userinfo']['groups']:
605605
name = request.form['name']
@@ -611,7 +611,7 @@ def template_edit(template_id):
611611

612612

613613
@app.route('/logout')
614-
@auth.oidc_logout('sso')
614+
@auth.oidc_logout
615615
def logout():
616616
return redirect(url_for('list_vms'), 302)
617617

proxstar/auth.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
2-
from flask_pyoidc.provider_configuration import ProviderConfiguration, ClientMetadata
32
from tenacity import retry
43

54

65
@retry
76
def get_auth(app):
8-
sso_config = ProviderConfiguration(
7+
auth = OIDCAuthentication(
8+
app,
99
issuer=app.config['OIDC_ISSUER'],
10-
client_metadata=ClientMetadata(
11-
app.config['OIDC_CLIENT_CONFIG']['client_id'],
12-
app.config['OIDC_CLIENT_CONFIG']['client_secret'],
13-
),
10+
client_registration_info=app.config['OIDC_CLIENT_CONFIG'],
1411
)
15-
16-
auth = OIDCAuthentication({'sso': sso_config}, app)
1712
return auth

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
black~=20.8b1
22
csh-ldap~=2.2.0
33
flask==1.1.2
4-
flask-pyoidc==3.7.0
4+
flask-pyoidc==1.3.0
55
gunicorn==20.0.4
66
paramiko==2.7.2
77
proxmoxer==1.1.1

0 commit comments

Comments
 (0)