| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_negotiate.h" | 5 #include "net/http/http_auth_handler_negotiate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/base/address_family.h" | 8 #include "net/base/address_family.h" |
| 9 #include "net/base/host_resolver.h" | 9 #include "net/base/host_resolver.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 user_callback_(NULL), | 37 user_callback_(NULL), |
| 38 auth_token_(NULL), | 38 auth_token_(NULL), |
| 39 next_state_(STATE_NONE), | 39 next_state_(STATE_NONE), |
| 40 url_security_manager_(url_security_manager) { | 40 url_security_manager_(url_security_manager) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 HttpAuthHandlerNegotiate::~HttpAuthHandlerNegotiate() { | 43 HttpAuthHandlerNegotiate::~HttpAuthHandlerNegotiate() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 int HttpAuthHandlerNegotiate::GenerateAuthTokenImpl( | 46 int HttpAuthHandlerNegotiate::GenerateAuthTokenImpl( |
| 47 const std::wstring* username, | 47 const string16* username, |
| 48 const std::wstring* password, | 48 const string16* password, |
| 49 const HttpRequestInfo* request, | 49 const HttpRequestInfo* request, |
| 50 CompletionCallback* callback, | 50 CompletionCallback* callback, |
| 51 std::string* auth_token) { | 51 std::string* auth_token) { |
| 52 DCHECK(user_callback_ == NULL); | 52 DCHECK(user_callback_ == NULL); |
| 53 DCHECK((username == NULL) == (password == NULL)); | 53 DCHECK((username == NULL) == (password == NULL)); |
| 54 DCHECK(auth_token_ == NULL); | 54 DCHECK(auth_token_ == NULL); |
| 55 auth_token_ = auth_token; | 55 auth_token_ = auth_token; |
| 56 if (already_called_) { | 56 if (already_called_) { |
| 57 DCHECK((!has_username_and_password_ && username == NULL) || | 57 DCHECK((!has_username_and_password_ && username == NULL) || |
| 58 (has_username_and_password_ && *username == username_ && | 58 (has_username_and_password_ && *username == username_ && |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 | 217 |
| 218 next_state_ = STATE_GENERATE_AUTH_TOKEN; | 218 next_state_ = STATE_GENERATE_AUTH_TOKEN; |
| 219 spn_ = CreateSPN(address_list_, origin_); | 219 spn_ = CreateSPN(address_list_, origin_); |
| 220 address_list_.Reset(); | 220 address_list_.Reset(); |
| 221 return rv; | 221 return rv; |
| 222 } | 222 } |
| 223 | 223 |
| 224 int HttpAuthHandlerNegotiate::DoGenerateAuthToken() { | 224 int HttpAuthHandlerNegotiate::DoGenerateAuthToken() { |
| 225 next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE; | 225 next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE; |
| 226 std::wstring* username = has_username_and_password_ ? &username_ : NULL; | 226 string16* username = has_username_and_password_ ? &username_ : NULL; |
| 227 std::wstring* password = has_username_and_password_ ? &password_ : NULL; | 227 string16* password = has_username_and_password_ ? &password_ : NULL; |
| 228 // TODO(cbentzel): This should possibly be done async. | 228 // TODO(cbentzel): This should possibly be done async. |
| 229 return auth_system_.GenerateAuthToken(username, password, spn_, auth_token_); | 229 return auth_system_.GenerateAuthToken(username, password, spn_, auth_token_); |
| 230 } | 230 } |
| 231 | 231 |
| 232 int HttpAuthHandlerNegotiate::DoGenerateAuthTokenComplete(int rv) { | 232 int HttpAuthHandlerNegotiate::DoGenerateAuthTokenComplete(int rv) { |
| 233 DCHECK_NE(ERR_IO_PENDING, rv); | 233 DCHECK_NE(ERR_IO_PENDING, rv); |
| 234 auth_token_ = NULL; | 234 auth_token_ = NULL; |
| 235 return rv; | 235 return rv; |
| 236 } | 236 } |
| 237 | 237 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 resolver_, disable_cname_lookup_, | 307 resolver_, disable_cname_lookup_, |
| 308 use_port_)); | 308 use_port_)); |
| 309 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 309 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
| 310 return ERR_INVALID_RESPONSE; | 310 return ERR_INVALID_RESPONSE; |
| 311 handler->swap(tmp_handler); | 311 handler->swap(tmp_handler); |
| 312 return OK; | 312 return OK; |
| 313 #endif | 313 #endif |
| 314 } | 314 } |
| 315 | 315 |
| 316 } // namespace net | 316 } // namespace net |
| OLD | NEW |