hola tengo un problema estoy creando un sistema de authencation con django rest framework
Código:
class SuperUserSessionAuthentication(authentication.BaseAuthentication):
def authenticate(self, request):
username = request.META.get('X_USERNAME') # get the username request header
password = request.META.get('X_PASSWORD')
print username
if not username: # no username passed in request headers
return None # authentication did not succeed
try:
user = User.objects.get(email=username) # get the user
if user.check_password(password):
return (user, None)
except User.DoesNotExist:
raise exceptions.AuthenticationFailed('No such user') # raise exception if user does not exist
return (user, None) # authentication successful
def authenticate_header(self, request):
return 'Basic'
cuando agrego los headers usando postman me dicen que no estan
en mis settings
Código:
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'src.user_site.rest_authentication.SuperUserSessionAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'src.user_site.rest_authentication.IsAuthenticated',
),