| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_auth_handler_digest.h" | 5 #include "net/http/http_auth_handler_digest.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/i18n/icu_string_conversions.h" | 9 #include "base/i18n/icu_string_conversions.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 return (original_realm_ != original_realm) ? | 130 return (original_realm_ != original_realm) ? |
| 131 HttpAuth::AUTHORIZATION_RESULT_DIFFERENT_REALM : | 131 HttpAuth::AUTHORIZATION_RESULT_DIFFERENT_REALM : |
| 132 HttpAuth::AUTHORIZATION_RESULT_REJECT; | 132 HttpAuth::AUTHORIZATION_RESULT_REJECT; |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool HttpAuthHandlerDigest::Init(HttpAuth::ChallengeTokenizer* challenge) { | 135 bool HttpAuthHandlerDigest::Init(HttpAuth::ChallengeTokenizer* challenge) { |
| 136 return ParseChallenge(challenge); | 136 return ParseChallenge(challenge); |
| 137 } | 137 } |
| 138 | 138 |
| 139 int HttpAuthHandlerDigest::GenerateAuthTokenImpl( | 139 int HttpAuthHandlerDigest::GenerateAuthTokenImpl( |
| 140 const AuthCredentials* credentials, | 140 const AuthCredentials* credentials, const HttpRequestInfo* request, |
| 141 const HttpRequestInfo* request, | 141 const CompletionCallback& callback, std::string* auth_token) { |
| 142 OldCompletionCallback* callback, | |
| 143 std::string* auth_token) { | |
| 144 // Generate a random client nonce. | 142 // Generate a random client nonce. |
| 145 std::string cnonce = nonce_generator_->GenerateNonce(); | 143 std::string cnonce = nonce_generator_->GenerateNonce(); |
| 146 | 144 |
| 147 // Extract the request method and path -- the meaning of 'path' is overloaded | 145 // Extract the request method and path -- the meaning of 'path' is overloaded |
| 148 // in certain cases, to be a hostname. | 146 // in certain cases, to be a hostname. |
| 149 std::string method; | 147 std::string method; |
| 150 std::string path; | 148 std::string path; |
| 151 GetRequestMethodAndPath(request, &method, &path); | 149 GetRequestMethodAndPath(request, &method, &path); |
| 152 | 150 |
| 153 *auth_token = AssembleCredentials(method, path, *credentials, | 151 *auth_token = AssembleCredentials(method, path, *credentials, |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 // TODO(eroman): Supposedly IIS server requires quotes surrounding qop. | 371 // TODO(eroman): Supposedly IIS server requires quotes surrounding qop. |
| 374 authorization += ", qop=" + QopToString(qop_); | 372 authorization += ", qop=" + QopToString(qop_); |
| 375 authorization += ", nc=" + nc; | 373 authorization += ", nc=" + nc; |
| 376 authorization += ", cnonce=" + HttpUtil::Quote(cnonce); | 374 authorization += ", cnonce=" + HttpUtil::Quote(cnonce); |
| 377 } | 375 } |
| 378 | 376 |
| 379 return authorization; | 377 return authorization; |
| 380 } | 378 } |
| 381 | 379 |
| 382 } // namespace net | 380 } // namespace net |
| OLD | NEW |