code: def check_digest_auth(user, passwd):
      
  
      if request.headers.get('Authorization'):
          credentials = parse_authorization_header(request.headers.get('Authorization'))
          if not credentials:
              return
          request_uri = request.script_root + request.path
          if request.query_string:
              request_uri +=  '?' + request.query_string
          response_hash = response(credentials, passwd, dict(uri=request_uri,
                                                             body=request.data,
                                                             method=request.method))
          if credentials.get('response') == response_hash:
              return True
      return False
docs: Check user authentication using HTTP Digest auth