Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: net/http/http_auth_handler_ntlm_win.cc

Issue 1393693002: [net/http auth] Split HttpAuthHandler creation from initialization. Base URL: https://chromium.googlesource.com/chromium/src.git@rename-auth-handler-methods
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_auth_handler_ntlm_portable.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler_ntlm_win.cc
diff --git a/net/http/http_auth_handler_ntlm_win.cc b/net/http/http_auth_handler_ntlm_win.cc
index 4b58be46f446510ad722a2b1414705796d30cb90..ca4b1bdf5baae8be57007cebb5baaf468e4f02d9 100644
--- a/net/http/http_auth_handler_ntlm_win.cc
+++ b/net/http/http_auth_handler_ntlm_win.cc
@@ -20,14 +20,14 @@
namespace net {
HttpAuthHandlerNTLM::HttpAuthHandlerNTLM(
- SSPILibrary* sspi_library, ULONG max_token_length,
+ SSPILibrary* sspi_library,
+ ULONG max_token_length,
URLSecurityManager* url_security_manager)
- : auth_sspi_(sspi_library, "NTLM", NTLMSP_NAME, max_token_length),
- url_security_manager_(url_security_manager) {
-}
+ : HttpAuthHandler("ntlm"),
+ auth_sspi_(sspi_library, "NTLM", NTLMSP_NAME, max_token_length),
+ url_security_manager_(url_security_manager) {}
-HttpAuthHandlerNTLM::~HttpAuthHandlerNTLM() {
-}
+HttpAuthHandlerNTLM::~HttpAuthHandlerNTLM() {}
// Require identity on first pass instead of second.
bool HttpAuthHandlerNTLM::NeedsIdentity() {
@@ -50,34 +50,24 @@ HttpAuthHandlerNTLM::Factory::Factory()
HttpAuthHandlerNTLM::Factory::~Factory() {
}
-int HttpAuthHandlerNTLM::Factory::CreateAuthHandler(
- const HttpAuthChallengeTokenizer& challenge,
- HttpAuth::Target target,
- const GURL& origin,
- CreateReason reason,
- int digest_nonce_count,
- const BoundNetLog& net_log,
- scoped_ptr<HttpAuthHandler>* handler) {
- if (is_unsupported_ || reason == CREATE_PREEMPTIVE)
- return ERR_UNSUPPORTED_AUTH_SCHEME;
+scoped_ptr<HttpAuthHandler>
+HttpAuthHandlerNTLM::Factory::CreateAuthHandlerForScheme(
+ const std::string& scheme) {
+ DCHECK(HttpAuth::IsValidNormalizedScheme(scheme));
+ if (scheme != "ntlm" || is_unsupported_)
+ return scoped_ptr<HttpAuthHandler>();
if (max_token_length_ == 0) {
int rv = DetermineMaxTokenLength(sspi_library_.get(), NTLMSP_NAME,
&max_token_length_);
if (rv == ERR_UNSUPPORTED_AUTH_SCHEME)
is_unsupported_ = true;
if (rv != OK)
- return rv;
+ return scoped_ptr<HttpAuthHandler>();
}
// TODO(cbentzel): Move towards model of parsing in the factory
// method and only constructing when valid.
- scoped_ptr<HttpAuthHandler> tmp_handler(
- new HttpAuthHandlerNTLM(sspi_library_.get(), max_token_length_,
- url_security_manager()));
- int result =
- tmp_handler->HandleInitialChallenge(challenge, target, origin, net_log);
- if (result == OK)
- handler->swap(tmp_handler);
- return result;
+ return make_scoped_ptr(new HttpAuthHandlerNTLM(
+ sspi_library_.get(), max_token_length_, url_security_manager()));
}
} // namespace net
« no previous file with comments | « net/http/http_auth_handler_ntlm_portable.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698