[Patchew-devel] [PATCH 2/3] rest: enable token-based authentication

Paolo Bonzini pbonzini at redhat.com
Mon May 13 13:52:55 UTC 2019


---
 patchew/settings.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/patchew/settings.py b/patchew/settings.py
index 11a79b4..dead744 100644
--- a/patchew/settings.py
+++ b/patchew/settings.py
@@ -47,6 +47,7 @@ INSTALLED_APPS = [
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'rest_framework',
+    'rest_framework.authtoken',
 ]
 
 MIDDLEWARE = [
@@ -62,6 +63,10 @@ MIDDLEWARE = [
 ]
 
 REST_FRAMEWORK = {
+    'DEFAULT_AUTHENTICATION_CLASSES': (
+        'rest_framework.authentication.TokenAuthentication',
+        'rest_framework.authentication.SessionAuthentication',
+    ),
     'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
     'URL_FIELD_NAME': 'resource_uri',
     'PAGE_SIZE': 50,
-- 
2.21.0





More information about the Patchew-devel mailing list