(self, auth_dict, password, method, uri)
| 125 | return auth_dict |
| 126 | |
| 127 | def _validate_auth(self, auth_dict, password, method, uri): |
| 128 | final_dict = {} |
| 129 | final_dict.update(auth_dict) |
| 130 | final_dict["password"] = password |
| 131 | final_dict["method"] = method |
| 132 | final_dict["uri"] = uri |
| 133 | HA1_str = "%(username)s:%(realm)s:%(password)s" % final_dict |
| 134 | HA1 = hashlib.md5(HA1_str.encode("ascii")).hexdigest() |
| 135 | HA2_str = "%(method)s:%(uri)s" % final_dict |
| 136 | HA2 = hashlib.md5(HA2_str.encode("ascii")).hexdigest() |
| 137 | final_dict["HA1"] = HA1 |
| 138 | final_dict["HA2"] = HA2 |
| 139 | response_str = "%(HA1)s:%(nonce)s:%(nc)s:" \ |
| 140 | "%(cnonce)s:%(qop)s:%(HA2)s" % final_dict |
| 141 | response = hashlib.md5(response_str.encode("ascii")).hexdigest() |
| 142 | |
| 143 | return response == auth_dict["response"] |
| 144 | |
| 145 | def _return_auth_challenge(self, request_handler): |
| 146 | request_handler.send_response(407, "Proxy Authentication Required") |
no test coverage detected