Browse Source

fix(api): remove obsolete IPAuthentication scheme

Obsolete since a8c793b56482d8cd0935adaaefa178861fdc1d32 has removed
the necessity for POSTing from nslord to dedyn.io.
Peter Thomassen 6 years ago
parent
commit
a767eff2a2
2 changed files with 1 additions and 21 deletions
  1. 1 20
      api/desecapi/authentication.py
  2. 0 1
      api/desecapi/views.py

+ 1 - 20
api/desecapi/authentication.py

@@ -1,5 +1,5 @@
 from __future__ import unicode_literals
 from __future__ import unicode_literals
-import base64, os
+import base64
 from rest_framework import exceptions, HTTP_HEADER_ENCODING
 from rest_framework import exceptions, HTTP_HEADER_ENCODING
 from rest_framework.authentication import BaseAuthentication, get_authorization_header, authenticate
 from rest_framework.authentication import BaseAuthentication, get_authorization_header, authenticate
 from desecapi.models import Domain, Token
 from desecapi.models import Domain, Token
@@ -98,22 +98,3 @@ class URLParamAuthentication(BaseAuthentication):
             raise exceptions.AuthenticationFailed('badauth')
             raise exceptions.AuthenticationFailed('badauth')
 
 
         return token.user, token
         return token.user, token
-
-
-class IPAuthentication(BaseAuthentication):
-
-    """
-    Authentication against remote IP address for dedyn.io management by nslord
-    """
-    def authenticate(self, request):
-        nslord = '%s.1.11' % os.environ['DESECSTACK_IPV4_REAR_PREFIX16']
-
-        # Make sure this is dual-stack safe
-        if request.META.get('REMOTE_ADDR') in [nslord, '::ffff:%s' % nslord]:
-            try:
-                domain = Domain.objects.get(name='dedyn.io')
-                return (domain.owner, None)
-            except Domain.DoesNotExist:
-                return None
-
-        return None

+ 0 - 1
api/desecapi/views.py

@@ -231,7 +231,6 @@ class RRsetDetail(generics.RetrieveUpdateDestroyAPIView):
 
 
 
 
 class RRsetList(ListBulkCreateUpdateAPIView):
 class RRsetList(ListBulkCreateUpdateAPIView):
-    authentication_classes = (auth.TokenAuthentication, auth.IPAuthentication,)
     serializer_class = RRsetSerializer
     serializer_class = RRsetSerializer
     permission_classes = (permissions.IsAuthenticated, IsDomainOwner,)
     permission_classes = (permissions.IsAuthenticated, IsDomainOwner,)