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

Side by Side Diff: net/http/http_auth_handler_negotiate.cc

Issue 1414313002: Allow dynamic updating of authentication policies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing NET_EXPORTs Created 5 years, 1 month 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
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_negotiate.h" 5 #include "net/http/http_auth_handler_negotiate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 12 matching lines...) Expand all
23 resolver_(NULL), 23 resolver_(NULL),
24 #if defined(OS_WIN) 24 #if defined(OS_WIN)
25 max_token_length_(0), 25 max_token_length_(0),
26 #endif 26 #endif
27 is_unsupported_(false) { 27 is_unsupported_(false) {
28 } 28 }
29 29
30 HttpAuthHandlerNegotiate::Factory::~Factory() { 30 HttpAuthHandlerNegotiate::Factory::~Factory() {
31 } 31 }
32 32
33 void HttpAuthHandlerNegotiate::Factory::SetNegotiateDisableCnameLookup(
34 bool disable_cname_lookup) {
35 disable_cname_lookup_ = disable_cname_lookup;
36 }
37
38 void HttpAuthHandlerNegotiate::Factory::SetNegotiateEnablePort(bool use_port) {
39 use_port_ = use_port;
40 }
41
33 void HttpAuthHandlerNegotiate::Factory::set_host_resolver( 42 void HttpAuthHandlerNegotiate::Factory::set_host_resolver(
34 HostResolver* resolver) { 43 HostResolver* resolver) {
35 resolver_ = resolver; 44 resolver_ = resolver;
36 } 45 }
37 46
47 #if defined(OS_ANDROID)
48 void HttpAuthHandlerNegotiate::Factory::SetAndroidAuthNegotiateAccountType(
49 const std::string& account_type) {
50 set_library(make_scoped_ptr(new std::string(account_type)));
51 }
52 #endif
53
38 int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( 54 int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler(
39 HttpAuthChallengeTokenizer* challenge, 55 HttpAuthChallengeTokenizer* challenge,
40 HttpAuth::Target target, 56 HttpAuth::Target target,
41 const GURL& origin, 57 const GURL& origin,
42 CreateReason reason, 58 CreateReason reason,
43 int digest_nonce_count, 59 int digest_nonce_count,
44 const BoundNetLog& net_log, 60 const BoundNetLog& net_log,
45 scoped_ptr<HttpAuthHandler>* handler) { 61 scoped_ptr<HttpAuthHandler>* handler) {
46 #if defined(OS_WIN) 62 #if defined(OS_WIN)
47 if (is_unsupported_ || reason == CREATE_PREEMPTIVE) 63 if (is_unsupported_ || reason == CREATE_PREEMPTIVE)
48 return ERR_UNSUPPORTED_AUTH_SCHEME; 64 return ERR_UNSUPPORTED_AUTH_SCHEME;
49 if (max_token_length_ == 0) { 65 if (max_token_length_ == 0) {
50 int rv = DetermineMaxTokenLength(auth_library_.get(), NEGOSSP_NAME, 66 int rv = DetermineMaxTokenLength(auth_library_.get(), NEGOSSP_NAME,
51 &max_token_length_); 67 &max_token_length_);
52 if (rv == ERR_UNSUPPORTED_AUTH_SCHEME) 68 if (rv == ERR_UNSUPPORTED_AUTH_SCHEME)
53 is_unsupported_ = true; 69 is_unsupported_ = true;
54 if (rv != OK) 70 if (rv != OK)
55 return rv; 71 return rv;
56 } 72 }
57 // TODO(cbentzel): Move towards model of parsing in the factory 73 // TODO(cbentzel): Move towards model of parsing in the factory
58 // method and only constructing when valid. 74 // method and only constructing when valid.
59 scoped_ptr<HttpAuthHandler> tmp_handler( 75 scoped_ptr<HttpAuthHandler> tmp_handler(
60 new HttpAuthHandlerNegotiate(auth_library_.get(), max_token_length_, 76 new HttpAuthHandlerNegotiate(auth_library_.get(), max_token_length_,
61 url_security_manager(), resolver_, 77 url_security_manager(), resolver_,
62 disable_cname_lookup_, use_port_)); 78 disable_cname_lookup_, use_port_));
63 #elif defined(OS_ANDROID) 79 #elif defined(OS_ANDROID)
64 if (is_unsupported_ || auth_library_->empty() || reason == CREATE_PREEMPTIVE) 80 if (is_unsupported_ || !auth_library_ || auth_library_->empty() ||
81 reason == CREATE_PREEMPTIVE)
65 return ERR_UNSUPPORTED_AUTH_SCHEME; 82 return ERR_UNSUPPORTED_AUTH_SCHEME;
66 // TODO(cbentzel): Move towards model of parsing in the factory 83 // TODO(cbentzel): Move towards model of parsing in the factory
67 // method and only constructing when valid. 84 // method and only constructing when valid.
68 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNegotiate( 85 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerNegotiate(
69 auth_library_.get(), url_security_manager(), resolver_, 86 auth_library_.get(), url_security_manager(), resolver_,
70 disable_cname_lookup_, use_port_)); 87 disable_cname_lookup_, use_port_));
71 #elif defined(OS_POSIX) 88 #elif defined(OS_POSIX)
72 if (is_unsupported_) 89 if (is_unsupported_)
73 return ERR_UNSUPPORTED_AUTH_SCHEME; 90 return ERR_UNSUPPORTED_AUTH_SCHEME;
74 if (!auth_library_->Init()) { 91 if (!auth_library_->Init()) {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 bool HttpAuthHandlerNegotiate::CanDelegate() const { 352 bool HttpAuthHandlerNegotiate::CanDelegate() const {
336 // TODO(cbentzel): Should delegation be allowed on proxies? 353 // TODO(cbentzel): Should delegation be allowed on proxies?
337 if (target_ == HttpAuth::AUTH_PROXY) 354 if (target_ == HttpAuth::AUTH_PROXY)
338 return false; 355 return false;
339 if (!url_security_manager_) 356 if (!url_security_manager_)
340 return false; 357 return false;
341 return url_security_manager_->CanDelegate(origin_); 358 return url_security_manager_->CanDelegate(origin_);
342 } 359 }
343 360
344 } // namespace net 361 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698