From cc52f74d9f5f4f8074cb04dd7c77cace348c6761 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sun, 8 Mar 2020 23:24:43 -0700 Subject: [PATCH] Correctly handle checking non-GET requests --- nginx_krbauth.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nginx_krbauth.py b/nginx_krbauth.py index dd1802e..8359182 100644 --- a/nginx_krbauth.py +++ b/nginx_krbauth.py @@ -11,9 +11,11 @@ import gssapi import ldap from flask import Flask, Response, redirect, request from gssapi.exceptions import BadMechanismError, GSSError, GeneralError +from werkzeug.routing import Rule app = Flask(__name__) app.logger.setLevel(logging.INFO) +app.url_map.add(Rule('/krbauth/check', endpoint='krbauth.check')) timestamp = struct.Struct('!q') hmac_digest = hashlib.sha512 @@ -177,7 +179,7 @@ def auth(): return make_401('No Authorization header sent', context) -@app.route('/krbauth/check') +@app.endpoint('krbauth.check') def check(): if verify_cookie(request.cookies.get('krbauth'), Context.from_request()): return Response(status=200)