From ad5c20a3c4a8714e0ec44b4f1a883c7181cc5b1c Mon Sep 17 00:00:00 2001 From: Branson Stephens <branson.stephens@ligo.org> Date: Mon, 15 Sep 2014 12:57:40 -0500 Subject: [PATCH] Added public url patterns in ligoauth/middlware/auth.py. Note: This is a temporary hack to facilitate registration with InCommon. --- ligoauth/middleware/auth.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ligoauth/middleware/auth.py b/ligoauth/middleware/auth.py index cf5ac5248..3cb2b694f 100644 --- a/ligoauth/middleware/auth.py +++ b/ligoauth/middleware/auth.py @@ -12,6 +12,15 @@ from django.http import HttpResponseForbidden proxyPattern = re.compile(r'^(.*?)(/CN=\d+)*$') +# XXX Hack. This will go away when we get the new perms infrastructure in place. +PUBLIC_URLS = [ + '/', + '/SPInfo', + '/SPInfo/', + '/SPPrivacy', + '/SPPrivacy/', +] + def cert_dn_from_request(request): """Take a request, rummage through SSL_* headers, return the DN for the user.""" certdn = request.META.get('SSL_CLIENT_S_DN') @@ -79,7 +88,9 @@ class LigoAuthMiddleware: request.user = user - if user is None: + # Check: Is the requested URL allowed for the PUBLIC? + #if user is None: + if user is None and request.path_info not in PUBLIC_URLS: # Forbidden! is_cli = request.POST.get('cli_version') or \ request.GET.get('cli_version') -- GitLab