Index: docs/topics/auth.txt
===================================================================
--- docs/topics/auth.txt	(revision 17683)
+++ docs/topics/auth.txt	(working copy)
@@ -1786,6 +1786,12 @@
     you need to force users to re-authenticate using different methods. A simple
     way to do that is simply to execute ``Session.objects.all().delete()``.
 
+.. versionadded:: 1.4
+
+If a backend raises a :class:`~django.core.exceptions.PermissionDenied`
+exception, authentication will immediately fail. Django won't check the backends that follow.
+
+
 Writing an authentication backend
 ---------------------------------
 
Index: django/contrib/auth/__init__.py
===================================================================
--- django/contrib/auth/__init__.py	(revision 17683)
+++ django/contrib/auth/__init__.py	(working copy)
@@ -1,5 +1,5 @@
 from warnings import warn
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, PermissionDenied
 from django.utils.importlib import import_module
 from django.contrib.auth.signals import user_logged_in, user_logged_out
 
@@ -46,6 +46,9 @@
         except TypeError:
             # This backend doesn't accept these credentials as arguments. Try the next one.
             continue
+        except PermissionDenied:
+            # This backend says to stop in our tracks - this user should not be allowed in at all.
+            return None
         if user is None:
             continue
         # Annotate the user object with the path of the backend.
Index: django/contrib/auth/tests/auth_backends.py
===================================================================
--- django/contrib/auth/tests/auth_backends.py	(revision 17683)
+++ django/contrib/auth/tests/auth_backends.py	(working copy)
@@ -1,7 +1,8 @@
 from django.conf import settings
 from django.contrib.auth.models import User, Group, Permission, AnonymousUser
 from django.contrib.contenttypes.models import ContentType
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, PermissionDenied
+from django.contrib.auth import authenticate
 from django.test import TestCase
 
 
@@ -306,3 +307,37 @@
         self.assertEqual(self.user1.has_module_perms("app1"), False)
         self.assertEqual(self.user1.has_module_perms("app2"), False)
 
+class PermissionDeniedBackend(object):
+    """
+    Always raises PermissionDenied.
+    """
+    supports_object_permissions = True
+    supports_anonymous_user = True
+    supports_inactive_user = True
+
+    def authenticate(self, username=None, password=None):
+        raise PermissionDenied
+
+
+class PermissionDeniedBackendTest(TestCase):
+    """
+    Tests that other backends are not checked once a backend raises PermissionDenied
+    """
+    backend = 'django.contrib.auth.tests.auth_backends.PermissionDeniedBackend'
+
+    def setUp(self):
+        self.curr_auth = settings.AUTHENTICATION_BACKENDS
+        self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
+        self.user1.save()
+
+    def tearDown(self):
+        settings.AUTHENTICATION_BACKENDS = self.curr_auth
+
+    def test_permission_denied(self):
+        "user is not authenticated after a backend raises permission denied #2550"
+        settings.AUTHENTICATION_BACKENDS = (self.backend,) + tuple(self.curr_auth)
+        self.assertEqual(authenticate(username='test', password='test'), None)
+
+    def test_authenticates(self):
+        settings.AUTHENTICATION_BACKENDS = tuple(self.curr_auth) + (self.backend,)
+        self.assertEqual(authenticate(username='test', password='test'), self.user1)
Index: django/contrib/auth/tests/__init__.py
===================================================================
--- django/contrib/auth/tests/__init__.py	(revision 17683)
+++ django/contrib/auth/tests/__init__.py	(working copy)
@@ -1,6 +1,6 @@
 from django.contrib.auth.tests.auth_backends import (BackendTest,
     RowlevelBackendTest, AnonymousUserBackendTest, NoBackendsTest,
-    InActiveUserBackendTest, NoInActiveUserBackendTest)
+    InActiveUserBackendTest, NoInActiveUserBackendTest, PermissionDeniedBackendTest)
 from django.contrib.auth.tests.basic import BasicTestCase
 from django.contrib.auth.tests.context_processors import AuthContextProcessorTests
 from django.contrib.auth.tests.decorators import LoginRequiredTestCase
