From cc52ab29f9583fce92192cc6ed61bd00d36b331b Mon Sep 17 00:00:00 2001
From: Tanner Prestegard <tanner.prestegard@ligo.org>
Date: Mon, 26 Nov 2018 10:36:26 -0600
Subject: [PATCH] Allow authentication by *ModelBackend

We had removed the ability for GraceDbModelBackend to do
authentication, but it is relied on for basic auth by the
BasicAuthentication class in django-rest-framework.  So we undo
that change and remove the GraceDbModelBackend class altogether
in favor of its parent, ModelPermissionsForObjectBackend.
---
 config/settings/base.py      |  2 +-
 gracedb/ligoauth/backends.py | 10 ----------
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/config/settings/base.py b/config/settings/base.py
index 4bbae4e08..55f8cbf68 100644
--- a/config/settings/base.py
+++ b/config/settings/base.py
@@ -308,7 +308,7 @@ X509_ISSUER_DN_HEADER = 'HTTP_SSL_CLIENT_I_DN'
 # handled by the REST_FRAMEWORK dictionary.
 AUTHENTICATION_BACKENDS = [
     'ligoauth.backends.ShibbolethRemoteUserBackend',
-    'ligoauth.backends.GraceDbModelBackend',
+    'ligoauth.backends.ModelPermissionsForObjectBackend',
     'guardian.backends.ObjectPermissionBackend',
 ]
 
diff --git a/gracedb/ligoauth/backends.py b/gracedb/ligoauth/backends.py
index abf6ad4b0..fa73816da 100644
--- a/gracedb/ligoauth/backends.py
+++ b/gracedb/ligoauth/backends.py
@@ -36,16 +36,6 @@ class ModelPermissionsForObjectBackend(backends.ModelBackend):
             perm, obj=None)
 
 
-class GraceDbModelBackend(ModelPermissionsForObjectBackend):
-    """
-    Main permission-checking backend for GraceDB.  We remove the ability
-    for this backend to authenticate users, since that is handled by other
-    auth backends.
-    """
-    def authenticate(self, request, username=None, password=None, **kwargs):
-        return None
-
-
 class ShibbolethRemoteUserBackend(backends.RemoteUserBackend):
     """
     Almost completely taken from Django's RemoteUserBackend, but we have to
-- 
GitLab