def authenticate(self, request):
"""
Returns a `User` if a correct username and password have been supplied
using URL parameters. Otherwise returns `None`.
"""
if not 'username' in request.query_params:
msg = 'No username URL parameter provided.'
raise exceptions.AuthenticationFailed(msg)
if not 'password' in request.query_params:
msg = 'No password URL parameter provided.'
raise exceptions.AuthenticationFailed(msg)
return self.authenticate_credentials(request.query_params['username'], request.query_params['password'])
评论列表
文章目录