mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-16 22:10:28 +00:00
Ensure admin API always uses SessionAuthentication backend
Fixes #5585 and (at least partly) #5628
This commit is contained in:
parent
c4506467b9
commit
605cedca78
2 changed files with 13 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
from rest_framework.authentication import SessionAuthentication
|
||||
|
||||
from wagtail.api.v2.endpoints import PagesAPIEndpoint
|
||||
from wagtail.api.v2.filters import (
|
||||
ChildOfFilter, DescendantOfFilter, FieldsFilter, ForExplorerFilter, OrderingFilter,
|
||||
|
|
@ -13,6 +15,7 @@ from .serializers import AdminPageSerializer
|
|||
|
||||
class PagesAdminAPIEndpoint(PagesAPIEndpoint):
|
||||
base_serializer_class = AdminPageSerializer
|
||||
authentication_classes = [SessionAuthentication]
|
||||
|
||||
# Use unrestricted child_of/descendant_of filters
|
||||
# Add has_children filter
|
||||
|
|
|
|||
|
|
@ -220,3 +220,13 @@ WAGTAILADMIN_RICH_TEXT_EDITORS = {
|
|||
'WIDGET': 'wagtail.tests.testapp.rich_text.CustomRichTextArea'
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
# Set a non-standard DEFAULT_AUTHENTICATION_CLASSES value, to verify that the
|
||||
# admin API still works with session-based auth regardless of this setting
|
||||
# (see https://github.com/wagtail/wagtail/issues/5585)
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': [
|
||||
'rest_framework.authentication.BasicAuthentication',
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue