diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-25 16:05:34 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-25 16:05:34 +0000 |
commit | 7c46fa57a345c80dbc812b450a9a2996ab6ace88 (patch) | |
tree | e6d3352695b9e7af5d58804bd065e3703b32c92c /net/http/http_auth_handler_ntlm_win.cc | |
parent | 09bde0c8d97f44a3a6476ac81d84697f05ecff6f (diff) | |
download | chromium_src-7c46fa57a345c80dbc812b450a9a2996ab6ace88.zip chromium_src-7c46fa57a345c80dbc812b450a9a2996ab6ace88.tar.gz chromium_src-7c46fa57a345c80dbc812b450a9a2996ab6ace88.tar.bz2 |
Added SSPILibrary interface so unit tests can mock SSPI calls.
BUG=None
TEST=net_unittests.exe --gtest_filter="*HttpAuthSSPI*"
Review URL: http://codereview.chromium.org/650164
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_handler_ntlm_win.cc')
-rw-r--r-- | net/http/http_auth_handler_ntlm_win.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/http/http_auth_handler_ntlm_win.cc b/net/http/http_auth_handler_ntlm_win.cc index cf3b448..989f1db 100644 --- a/net/http/http_auth_handler_ntlm_win.cc +++ b/net/http/http_auth_handler_ntlm_win.cc @@ -19,8 +19,9 @@ namespace net { -HttpAuthHandlerNTLM::HttpAuthHandlerNTLM(ULONG max_token_length) : - auth_sspi_("NTLM", NTLMSP_NAME, max_token_length) { +HttpAuthHandlerNTLM::HttpAuthHandlerNTLM(SSPILibrary* sspi_library, + ULONG max_token_length) : + auth_sspi_(sspi_library, "NTLM", NTLMSP_NAME, max_token_length) { } HttpAuthHandlerNTLM::~HttpAuthHandlerNTLM() { @@ -64,7 +65,8 @@ int HttpAuthHandlerNTLM::GenerateDefaultAuthToken( HttpAuthHandlerNTLM::Factory::Factory() : max_token_length_(0), first_creation_(true), - is_unsupported_(false) { + is_unsupported_(false), + sspi_library_(SSPILibrary::GetDefault()) { } HttpAuthHandlerNTLM::Factory::~Factory() { @@ -77,19 +79,18 @@ int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( scoped_refptr<HttpAuthHandler>* handler) { if (is_unsupported_) return ERR_UNSUPPORTED_AUTH_SCHEME; - if (max_token_length_ == 0) { - int rv = DetermineMaxTokenLength(NTLMSP_NAME, &max_token_length_); + int rv = DetermineMaxTokenLength(sspi_library_, NTLMSP_NAME, + &max_token_length_); if (rv == ERR_UNSUPPORTED_AUTH_SCHEME) is_unsupported_ = true; if (rv != OK) return rv; } - // TODO(cbentzel): Move towards model of parsing in the factory // method and only constructing when valid. scoped_refptr<HttpAuthHandler> tmp_handler( - new HttpAuthHandlerNTLM(max_token_length_)); + new HttpAuthHandlerNTLM(sspi_library_, max_token_length_)); if (!tmp_handler->InitFromChallenge(challenge, target, origin)) return ERR_INVALID_RESPONSE; handler->swap(tmp_handler); @@ -97,4 +98,3 @@ int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( } } // namespace net - |