Created
July 12, 2017 16:44
-
-
Save OndrejIT/c51f63506d35463fbe3d35f7891920bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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