From 9e0ada5f3d341e1f8245bbd7ac26ffc56e336ac7 Mon Sep 17 00:00:00 2001 From: Sam Collins Date: Sat, 25 Feb 2017 22:04:43 +0000 Subject: [PATCH] Added Auth to Django REST API --- config/settings/common.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/settings/common.py b/config/settings/common.py index b94ab31..7c1d361 100644 --- a/config/settings/common.py +++ b/config/settings/common.py @@ -309,6 +309,14 @@ REST_FRAMEWORK = { 'django_filters.rest_framework.DjangoFilterBackend', 'rest_framework.filters.OrderingFilter' ), + 'DEFAULT_PERMISSION_CLASSES': ( + 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly', + ), + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework.authentication.BasicAuthentication', + 'rest_framework.authentication.SessionAuthentication', + 'rest_framework.authentication.TokenAuthentication', + ), 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 50 }