Skip to content

Instantly share code, notes, and snippets.

@OndrejIT
Created July 12, 2017 16:44
Show Gist options
  • Save OndrejIT/c51f63506d35463fbe3d35f7891920bd to your computer and use it in GitHub Desktop.
Save OndrejIT/c51f63506d35463fbe3d35f7891920bd to your computer and use it in GitHub Desktop.
# Author Ondrej Barta
# [email protected]
# Copyright 2017
from django.conf import settings
from rest_framework import authentication, permissions
class BasicAuthentication(authentication.BasicAuthentication):
def authenticate_credentials(self, userid, password):
if userid == settings.CONFIG.api.user and password == settings.CONFIG.api.password:
return userid, None
class BasicPermissions(permissions.BasePermission):
def has_permission(self, request, view):
return request.user == settings.CONFIG.api.user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment