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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 "DigestRealm", | 95 "DigestRealm", |
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 #if defined(USE_KERBEROS) | |
105 { | 106 { |
106 // Choose Negotiate over NTLM on all platforms. | 107 // Choose Negotiate over NTLM on all platforms. |
107 // TODO(ahendrickson): This may be flaky on Linux and OSX as it | 108 // 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 | 109 // relies on being able to load one of the known .so files |
109 // for gssapi. | 110 // for gssapi. |
110 "WWW-Authenticate: Negotiate\n" | 111 "WWW-Authenticate: Negotiate\n" |
111 "WWW-Authenticate: NTLM\n", | 112 "WWW-Authenticate: NTLM\n", |
112 | 113 |
113 HttpAuth::AUTH_SCHEME_NEGOTIATE, | 114 HttpAuth::AUTH_SCHEME_NEGOTIATE, |
114 "", | 115 "", |
115 } | 116 } |
wtc
2011/08/12 17:21:51
This probably can also have a #else block.
Paweł Hajdan Jr.
2011/08/12 18:14:42
Done.
| |
117 #endif // defined(USE_KERBEROS) | |
116 }; | 118 }; |
117 GURL origin("http://www.example.com"); | 119 GURL origin("http://www.example.com"); |
118 std::set<HttpAuth::Scheme> disabled_schemes; | 120 std::set<HttpAuth::Scheme> disabled_schemes; |
119 MockAllowURLSecurityManager url_security_manager; | 121 MockAllowURLSecurityManager url_security_manager; |
120 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); | 122 scoped_ptr<HostResolver> host_resolver(new MockHostResolver()); |
121 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( | 123 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( |
122 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); | 124 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); |
123 http_auth_handler_factory->SetURLSecurityManager( | 125 http_auth_handler_factory->SetURLSecurityManager( |
124 "negotiate", &url_security_manager); | 126 "negotiate", &url_security_manager); |
125 | 127 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 std::string name; | 423 std::string name; |
422 | 424 |
423 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); | 425 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); |
424 EXPECT_STREQ("Authorization", name.c_str()); | 426 EXPECT_STREQ("Authorization", name.c_str()); |
425 | 427 |
426 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); | 428 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); |
427 EXPECT_STREQ("Proxy-Authorization", name.c_str()); | 429 EXPECT_STREQ("Proxy-Authorization", name.c_str()); |
428 } | 430 } |
429 | 431 |
430 } // namespace net | 432 } // namespace net |
OLD | NEW |