| 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 #include <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 }, | 96 }, |
| 97 { | 97 { |
| 98 // Handle an empty header correctly. | 98 // Handle an empty header correctly. |
| 99 "Y: Digest realm=\"X\", nonce=\"aaaaaaaaaa\"\n" | 99 "Y: Digest realm=\"X\", nonce=\"aaaaaaaaaa\"\n" |
| 100 "www-authenticate:\n", | 100 "www-authenticate:\n", |
| 101 | 101 |
| 102 HttpAuth::AUTH_SCHEME_MAX, | 102 HttpAuth::AUTH_SCHEME_MAX, |
| 103 "", | 103 "", |
| 104 }, | 104 }, |
| 105 { | 105 { |
| 106 "WWW-Authenticate: Negotiate\n" |
| 107 "WWW-Authenticate: NTLM\n", |
| 108 |
| 109 #if defined(USE_KERBEROS) |
| 106 // Choose Negotiate over NTLM on all platforms. | 110 // Choose Negotiate over NTLM on all platforms. |
| 107 // TODO(ahendrickson): This may be flaky on Linux and OSX as it | 111 // TODO(ahendrickson): This may be flaky on Linux and OSX as it |
| 108 // relies on being able to load one of the known .so files | 112 // relies on being able to load one of the known .so files |
| 109 // for gssapi. | 113 // for gssapi. |
| 110 "WWW-Authenticate: Negotiate\n" | |
| 111 "WWW-Authenticate: NTLM\n", | |
| 112 | |
| 113 HttpAuth::AUTH_SCHEME_NEGOTIATE, | 114 HttpAuth::AUTH_SCHEME_NEGOTIATE, |
| 115 #else |
| 116 // On systems that don't use Kerberos fall back to NTLM. |
| 117 HttpAuth::AUTH_SCHEME_NTLM, |
| 118 #endif // defined(USE_KERBEROS) |
| 114 "", | 119 "", |
| 115 } | 120 } |
| 116 }; | 121 }; |
| 117 GURL origin("http://www.example.com"); | 122 GURL origin("http://www.example.com"); |
| 118 std::set<HttpAuth::Scheme> disabled_schemes; | 123 std::set<HttpAuth::Scheme> disabled_schemes; |
| 119 MockAllowURLSecurityManager url_security_manager; | 124 MockAllowURLSecurityManager url_security_manager; |
| 120 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); | 125 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); |
| 121 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( | 126 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( |
| 122 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); | 127 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); |
| 123 http_auth_handler_factory->SetURLSecurityManager( | 128 http_auth_handler_factory->SetURLSecurityManager( |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 std::string name; | 426 std::string name; |
| 422 | 427 |
| 423 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); | 428 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); |
| 424 EXPECT_STREQ("Authorization", name.c_str()); | 429 EXPECT_STREQ("Authorization", name.c_str()); |
| 425 | 430 |
| 426 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); | 431 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); |
| 427 EXPECT_STREQ("Proxy-Authorization", name.c_str()); | 432 EXPECT_STREQ("Proxy-Authorization", name.c_str()); |
| 428 } | 433 } |
| 429 | 434 |
| 430 } // namespace net | 435 } // namespace net |
| OLD | NEW |