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