【发布时间】:2016-08-24 17:10:02
【问题描述】:
我正在使用带有以下代码的 Django REST 框架基本身份验证:
class MyBasicAuthentication(BasicAuthentication):
def authenticate_header(self, request):
return 'xBasic realm="%s"' % self.www_authenticate_realm
class AuthView(APIView):
authentication_classes = (MyBasicAuthentication,)
serializer_class = UserSerializer
def post(self, request, *args, **kwargs):
user = authenticate(username=request.user.username, password=request.user.password)
login(request, user)
response = get_user_basic_info(request.user)
return Response(response)
它工作正常,但我需要使此身份验证对用户名不区分大小写。有什么建议吗?
【问题讨论】:
标签: python django authentication django-rest-framework case-insensitive