From 901b0f72249a33e760e3cab6b208dc697599b882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sun, 13 Dec 2015 18:27:09 +0000 Subject: [PATCH] api: Fix lookup of user context variable --- certidude/auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/certidude/auth.py b/certidude/auth.py index e633d5a..6593d19 100644 --- a/certidude/auth.py +++ b/certidude/auth.py @@ -73,7 +73,7 @@ def login_required(func): raise error.LoginFailed('Authentication System Failure %s(%s)' % (ex.args[0][0], ex.args[1][0],)) if result == kerberos.AUTH_GSS_COMPLETE: - logger.debug("Succesfully authenticated user %s for %s from %s", user, req.env["PATH_INFO"], req.env["REMOTE_ADDR"]) + logger.debug("Succesfully authenticated user %s for %s from %s", req.context["user"], req.env["PATH_INFO"], req.env["REMOTE_ADDR"]) return func(resource, req, resp, *args, **kwargs) elif result == kerberos.AUTH_GSS_CONTINUE: # TODO: logger.error @@ -97,12 +97,12 @@ def authorize_admin(func): if subnet.overlaps(remote_addr): break else: - logger.info("Rejected access to administrative call %s by %s from %s, source address not whitelisted", req.env["PATH_INFO"], user, req.env["REMOTE_ADDR"]) + logger.info("Rejected access to administrative call %s by %s from %s, source address not whitelisted", req.env["PATH_INFO"], req.context["user"], req.env["REMOTE_ADDR"]) raise falcon.HTTPForbidden("Forbidden", "Remote address %s not whitelisted" % remote_addr) # Check for username whitelist if req.context.get("user") not in config.ADMIN_USERS: - logger.info("Rejected access to administrative call %s by %s from %s, user not whitelisted", req.env["PATH_INFO"], user, req.env["REMOTE_ADDR"]) + logger.info("Rejected access to administrative call %s by %s from %s, user not whitelisted", req.env["PATH_INFO"], req.context["user"], req.env["REMOTE_ADDR"]) raise falcon.HTTPForbidden("Forbidden", "User %s not whitelisted" % req.context.get("user")) # Retain username, TODO: Better abstraction with username, e-mail, sn, gn?