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

Side by Side Diff: net/http/http_auth_handler_ntlm_portable.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 unified diff | Download patch
« no previous file with comments | « net/http/http_auth_handler_ntlm.cc ('k') | net/http/http_auth_handler_ntlm_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_ntlm.h" 5 #include "net/http/http_auth_handler_ntlm.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 // For gethostname 8 // For gethostname
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 // [MS-NTHT]. 628 // [MS-NTHT].
629 629
630 // static 630 // static
631 HttpAuthHandlerNTLM::GenerateRandomProc 631 HttpAuthHandlerNTLM::GenerateRandomProc
632 HttpAuthHandlerNTLM::generate_random_proc_ = GenerateRandom; 632 HttpAuthHandlerNTLM::generate_random_proc_ = GenerateRandom;
633 633
634 // static 634 // static
635 HttpAuthHandlerNTLM::HostNameProc 635 HttpAuthHandlerNTLM::HostNameProc
636 HttpAuthHandlerNTLM::get_host_name_proc_ = GetHostName; 636 HttpAuthHandlerNTLM::get_host_name_proc_ = GetHostName;
637 637
638 HttpAuthHandlerNTLM::HttpAuthHandlerNTLM() { 638 HttpAuthHandlerNTLM::HttpAuthHandlerNTLM() : HttpAuthHandler("ntlm") {}
639 }
640 639
641 bool HttpAuthHandlerNTLM::NeedsIdentity() { 640 bool HttpAuthHandlerNTLM::NeedsIdentity() {
642 // This gets called for each round-trip. Only require identity on 641 // This gets called for each round-trip. Only require identity on
643 // the first call (when auth_data_ is empty). On subsequent calls, 642 // the first call (when auth_data_ is empty). On subsequent calls,
644 // we use the initially established identity. 643 // we use the initially established identity.
645 return auth_data_.empty(); 644 return auth_data_.empty();
646 } 645 }
647 646
648 bool HttpAuthHandlerNTLM::AllowsDefaultCredentials() { 647 bool HttpAuthHandlerNTLM::AllowsDefaultCredentials() {
649 // Default credentials are not supported in the portable implementation of 648 // Default credentials are not supported in the portable implementation of
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 } else { 702 } else {
704 rv = GenerateType1Msg(out_token, out_token_len); 703 rv = GenerateType1Msg(out_token, out_token_len);
705 } 704 }
706 705
707 if (rv == OK) 706 if (rv == OK)
708 LogToken("out-token", *out_token, *out_token_len); 707 LogToken("out-token", *out_token, *out_token_len);
709 708
710 return rv; 709 return rv;
711 } 710 }
712 711
713 int HttpAuthHandlerNTLM::Factory::CreateAuthHandler( 712 scoped_ptr<HttpAuthHandler>
714 const HttpAuthChallengeTokenizer& challenge, 713 HttpAuthHandlerNTLM::Factory::CreateAuthHandlerForScheme(
715 HttpAuth::Target target, 714 const std::string& scheme) {
716 const GURL& origin, 715 DCHECK(HttpAuth::IsValidNormalizedScheme(scheme));
717 CreateReason reason, 716 if (scheme != "ntlm")
718 int digest_nonce_count, 717 return scoped_ptr<HttpAuthHandler>();
719 const BoundNetLog& net_log, 718 // TODO(cbentzel): Move towards model of parsing in the factory method and
720 scoped_ptr<HttpAuthHandler>* handler) { 719 // only constructing when valid. NOTE: Default credentials are not supported
721 if (reason == CREATE_PREEMPTIVE) 720 // for the portable implementation of NTLM.
722 return ERR_UNSUPPORTED_AUTH_SCHEME; 721 return make_scoped_ptr(new HttpAuthHandlerNTLM);
723 // TODO(cbentzel): Move towards model of parsing in the factory
724 // method and only constructing when valid.
725 // NOTE: Default credentials are not supported for the portable implementation
726 // of NTLM.
727 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNTLM);
728 int result =
729 tmp_handler->HandleInitialChallenge(challenge, target, origin, net_log);
730 if (result == OK)
731 handler->swap(tmp_handler);
732 return result;
733 } 722 }
734 723
735 } // namespace net 724 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_ntlm.cc ('k') | net/http/http_auth_handler_ntlm_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698