18
18
from django .views .generic .list import ListView
19
19
from notifications .models import Notification
20
20
from rest_framework import mixins , status , viewsets
21
- from rest_framework .authentication import SessionAuthentication , TokenAuthentication
21
+ from rest_framework .authentication import SessionAuthentication
22
22
from rest_framework .decorators import action
23
23
from rest_framework .exceptions import MethodNotAllowed , ValidationError
24
24
from rest_framework .filters import BaseFilterBackend , OrderingFilter
28
28
from FTB .ProgramConfiguration import ProgramConfiguration
29
29
from FTB .Signatures .CrashInfo import CrashInfo
30
30
from server .auth import CheckAppPermission
31
+ from server .utils import IPRestrictedTokenAuthentication
31
32
32
33
from .forms import (
33
34
BugzillaTemplateBugForm ,
@@ -1017,7 +1018,7 @@ class CrashEntryViewSet(
1017
1018
):
1018
1019
"""API endpoint that allows adding/viewing CrashEntries"""
1019
1020
1020
- authentication_classes = (TokenAuthentication , SessionAuthentication )
1021
+ authentication_classes = (IPRestrictedTokenAuthentication , SessionAuthentication )
1021
1022
queryset = CrashEntry .objects .all ().select_related (
1022
1023
"product" , "platform" , "os" , "client" , "tool" , "testcase"
1023
1024
)
@@ -1143,7 +1144,7 @@ class BucketViewSet(
1143
1144
):
1144
1145
"""API endpoint that allows viewing Buckets"""
1145
1146
1146
- authentication_classes = (TokenAuthentication , SessionAuthentication )
1147
+ authentication_classes = (IPRestrictedTokenAuthentication , SessionAuthentication )
1147
1148
queryset = Bucket .objects .all ().select_related ("bug" , "bug__externalType" )
1148
1149
serializer_class = BucketSerializer
1149
1150
filter_backends = [
@@ -1430,7 +1431,7 @@ class BugProviderViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
1430
1431
API endpoint that allows listing BugProviders
1431
1432
"""
1432
1433
1433
- authentication_classes = (TokenAuthentication , SessionAuthentication )
1434
+ authentication_classes = (IPRestrictedTokenAuthentication , SessionAuthentication )
1434
1435
queryset = BugProvider .objects .all ()
1435
1436
serializer_class = BugProviderSerializer
1436
1437
@@ -1442,7 +1443,7 @@ class BugzillaTemplateViewSet(
1442
1443
API endpoint that allows viewing BugzillaTemplates
1443
1444
"""
1444
1445
1445
- authentication_classes = (TokenAuthentication , SessionAuthentication )
1446
+ authentication_classes = (IPRestrictedTokenAuthentication , SessionAuthentication )
1446
1447
queryset = BugzillaTemplate .objects .all ()
1447
1448
serializer_class = BugzillaTemplateSerializer
1448
1449
@@ -1452,7 +1453,7 @@ class NotificationViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
1452
1453
API endpoint that allows listing unread Notifications
1453
1454
"""
1454
1455
1455
- authentication_classes = (TokenAuthentication , SessionAuthentication )
1456
+ authentication_classes = (IPRestrictedTokenAuthentication , SessionAuthentication )
1456
1457
serializer_class = NotificationSerializer
1457
1458
filter_backends = [
1458
1459
JsonQueryFilterBackend ,
@@ -1545,7 +1546,7 @@ def get_query_obj(obj, key=None):
1545
1546
1546
1547
1547
1548
class AbstractDownloadView (APIView ):
1548
- authentication_classes = (TokenAuthentication , SessionAuthentication )
1549
+ authentication_classes = (IPRestrictedTokenAuthentication , SessionAuthentication )
1549
1550
permission_classes = (CheckAppPermission ,)
1550
1551
1551
1552
def response (self , file_path , filename , content_type = "application/octet-stream" ):
@@ -1765,7 +1766,7 @@ class CrashStatsViewSet(viewsets.GenericViewSet):
1765
1766
API endpoint that allows retrieving CrashManager statistics
1766
1767
"""
1767
1768
1768
- authentication_classes = (TokenAuthentication , SessionAuthentication )
1769
+ authentication_classes = (IPRestrictedTokenAuthentication , SessionAuthentication )
1769
1770
queryset = CrashEntry .objects .all ()
1770
1771
filter_backends = [
1771
1772
ToolFilterCrashesBackend ,
0 commit comments