| 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 // See "SSPI Sample Application" at | 5 // See "SSPI Sample Application" at |
| 6 // http://msdn.microsoft.com/en-us/library/aa918273.aspx | 6 // http://msdn.microsoft.com/en-us/library/aa918273.aspx |
| 7 // and "NTLM Security Support Provider" at | 7 // and "NTLM Security Support Provider" at |
| 8 // http://msdn.microsoft.com/en-us/library/aa923611.aspx. | 8 // http://msdn.microsoft.com/en-us/library/aa923611.aspx. |
| 9 | 9 |
| 10 #include "net/http/http_auth_handler_ntlm.h" | 10 #include "net/http/http_auth_handler_ntlm.h" |
| 11 | 11 |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/http/http_auth_preferences.h" | 14 #include "net/http/http_auth_preferences.h" |
| 15 #include "net/http/http_auth_sspi_win.h" | 15 #include "net/http/http_auth_sspi_win.h" |
| 16 | 16 |
| 17 #pragma comment(lib, "secur32.lib") | |
| 18 | |
| 19 namespace net { | 17 namespace net { |
| 20 | 18 |
| 21 HttpAuthHandlerNTLM::HttpAuthHandlerNTLM( | 19 HttpAuthHandlerNTLM::HttpAuthHandlerNTLM( |
| 22 SSPILibrary* sspi_library, | 20 SSPILibrary* sspi_library, |
| 23 ULONG max_token_length, | 21 ULONG max_token_length, |
| 24 const HttpAuthPreferences* http_auth_preferences) | 22 const HttpAuthPreferences* http_auth_preferences) |
| 25 : auth_sspi_(sspi_library, "NTLM", NTLMSP_NAME, max_token_length), | 23 : auth_sspi_(sspi_library, "NTLM", NTLMSP_NAME, max_token_length), |
| 26 http_auth_preferences_(http_auth_preferences) {} | 24 http_auth_preferences_(http_auth_preferences) {} |
| 27 | 25 |
| 28 HttpAuthHandlerNTLM::~HttpAuthHandlerNTLM() { | 26 HttpAuthHandlerNTLM::~HttpAuthHandlerNTLM() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM( | 71 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM( |
| 74 sspi_library_.get(), max_token_length_, http_auth_preferences())); | 72 sspi_library_.get(), max_token_length_, http_auth_preferences())); |
| 75 if (!tmp_handler->InitFromChallenge(challenge, target, ssl_info, origin, | 73 if (!tmp_handler->InitFromChallenge(challenge, target, ssl_info, origin, |
| 76 net_log)) | 74 net_log)) |
| 77 return ERR_INVALID_RESPONSE; | 75 return ERR_INVALID_RESPONSE; |
| 78 handler->swap(tmp_handler); | 76 handler->swap(tmp_handler); |
| 79 return OK; | 77 return OK; |
| 80 } | 78 } |
| 81 | 79 |
| 82 } // namespace net | 80 } // namespace net |
| OLD | NEW |