Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
40573b27
Commit
40573b27
authored
May 17, 2011
by
markotibold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nicely marked up source code.
parent
66b9bda9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
djangorestframework/authentication.py
+17
-14
No files found.
djangorestframework/authentication.py
View file @
40573b27
"""
"""
The
``authentication`
` module provides a set of pluggable authentication classes.
The
:mod:`authentication
` module provides a set of pluggable authentication classes.
Authentication behavior is provided by
adding the ``AuthMixin`` class to a ``View``
.
Authentication behavior is provided by
mixing the :class:`mixins.AuthMixin` class into a :class:`View` class
.
The set of authentication methods which are used is then specified by setting the
The set of authentication methods which are used is then specified by setting the
``authentication`` attribute on the ``View`
` class, and listing a set of authentication classes.
:attr:`authentication` attribute on the :class:`View
` class, and listing a set of authentication classes.
"""
"""
from
django.contrib.auth
import
authenticate
from
django.contrib.auth
import
authenticate
...
@@ -22,28 +22,31 @@ __all__ = (
...
@@ -22,28 +22,31 @@ __all__ = (
class
BaseAuthenticaton
(
object
):
class
BaseAuthenticaton
(
object
):
"""
"""
All authentication classes should extend BaseAuthentication.
All authentication classes should extend BaseAuthentication.
:param view: :class:`Authentication` classes are always passed the current view on creation.
"""
"""
def
__init__
(
self
,
view
):
def
__init__
(
self
,
view
):
"""
"""
Authentication classes are always passed the current view on creation.
"""
"""
self
.
view
=
view
self
.
view
=
view
def
authenticate
(
self
,
request
):
def
authenticate
(
self
,
request
):
"""
"""
Authenticate the request and return a ``User`` instance or None. (*)
:param request: Request to be authenticated
:rtype: :obj:`User` object or None [*]_
This function must be overridden to be implemented.
.. Note::
This function must be overridden to be implemented.
(*) The authentication context _will_ typically be a ``User`
` object,
.. [*] The authentication context *will* typically be a :obj:`User
` object,
but it need not be. It can be any user-like object so long as the
but it need not be. It can be any user-like object so long as the
permissions classes on the view can handle the object and use
permissions classes on the view can handle the object and use
it to determine if the request has the required permissions or not.
it to determine if the request has the required permissions or not.
This can be an important distinction if you're implementing some token
This can be an important distinction if you're implementing some token
based authentication mechanism, where the authentication context
based authentication mechanism, where the authentication context
may be more involved than simply mapping to a ``User`
`.
may be more involved than simply mapping to a :obj:`User
`.
"""
"""
return
None
return
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment