Code

Ticket #4888: authentication.txt.diff

File authentication.txt.diff, 1.4 KB (added by Piotr Lewandowski <django@…>, 7 years ago)
Line 
1Index: authentication.txt
2===================================================================
3--- authentication.txt  (revision 5717)
4+++ authentication.txt  (working copy)
5@@ -959,23 +959,21 @@
6 ---------------------------------
7 
8 An authentication backend is a class that implements two methods:
9-``get_user(id)`` and ``authenticate(**credentials)``.
10+``get_user(user_id)`` and ``authenticate(**credentials)``.
11 
12-The ``get_user`` method takes an ``id`` -- which could be a username, database
13+The ``get_user`` method takes an ``user_id`` -- which could be a username, database
14 ID or whatever -- and returns a ``User`` object.
15 
16 The  ``authenticate`` method takes credentials as keyword arguments. Most of
17 the time, it'll just look like this::
18 
19-    class MyBackend:
20-        def authenticate(self, username=None, password=None):
21-            # Check the username/password and return a User.
22+    def authenticate(self, username=None, password=None):
23+        # Check the username/password and return a User.
24 
25 But it could also authenticate a token, like so::
26 
27-    class MyBackend:
28-        def authenticate(self, token=None):
29-            # Check the token and return a User.
30+    def authenticate(self, token=None):
31+        # Check the token and return a User.
32 
33 Either way, ``authenticate`` should check the credentials it gets, and it
34 should return a ``User`` object that matches those credentials, if the