| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/ref_counted.h" | 7 #include "base/ref_counted.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 "WWW-Authenticate: NTLM\n", | 63 "WWW-Authenticate: NTLM\n", |
| 64 | 64 |
| 65 // TODO(ahendrickson): This may be flaky on Linux and OSX as it | 65 // TODO(ahendrickson): This may be flaky on Linux and OSX as it |
| 66 // relies on being able to load one of the known .so files | 66 // relies on being able to load one of the known .so files |
| 67 // for gssapi. | 67 // for gssapi. |
| 68 "negotiate", | 68 "negotiate", |
| 69 "", | 69 "", |
| 70 } | 70 } |
| 71 }; | 71 }; |
| 72 GURL origin("http://www.example.com"); | 72 GURL origin("http://www.example.com"); |
| 73 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory( | 73 URLSecurityManagerAllow url_security_manager; |
| 74 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( |
| 74 HttpAuthHandlerFactory::CreateDefault()); | 75 HttpAuthHandlerFactory::CreateDefault()); |
| 76 http_auth_handler_factory->SetURLSecurityManager( |
| 77 "negotiate", &url_security_manager); |
| 75 | 78 |
| 76 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 79 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 77 // Make a HttpResponseHeaders object. | 80 // Make a HttpResponseHeaders object. |
| 78 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); | 81 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); |
| 79 headers_with_status_line += tests[i].headers; | 82 headers_with_status_line += tests[i].headers; |
| 80 scoped_refptr<net::HttpResponseHeaders> headers( | 83 scoped_refptr<net::HttpResponseHeaders> headers( |
| 81 new net::HttpResponseHeaders( | 84 new net::HttpResponseHeaders( |
| 82 net::HttpUtil::AssembleRawHeaders( | 85 net::HttpUtil::AssembleRawHeaders( |
| 83 headers_with_status_line.c_str(), | 86 headers_with_status_line.c_str(), |
| 84 headers_with_status_line.length()))); | 87 headers_with_status_line.length()))); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" | 182 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" |
| 180 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" | 183 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" |
| 181 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" | 184 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" |
| 182 "BtAAAAAAA=\r\n", | 185 "BtAAAAAAA=\r\n", |
| 183 | 186 |
| 184 // Realm is empty. | 187 // Realm is empty. |
| 185 "", | 188 "", |
| 186 } | 189 } |
| 187 }; | 190 }; |
| 188 GURL origin("http://www.example.com"); | 191 GURL origin("http://www.example.com"); |
| 189 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory( | 192 URLSecurityManagerAllow url_security_manager; |
| 193 scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_factory( |
| 190 HttpAuthHandlerFactory::CreateDefault()); | 194 HttpAuthHandlerFactory::CreateDefault()); |
| 195 http_auth_handler_factory->SetURLSecurityManager( |
| 196 "negotiate", &url_security_manager); |
| 191 | 197 |
| 192 scoped_ptr<HttpAuthHandler> handler; | 198 scoped_ptr<HttpAuthHandler> handler; |
| 193 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 199 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 194 // Make a HttpResponseHeaders object. | 200 // Make a HttpResponseHeaders object. |
| 195 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); | 201 std::string headers_with_status_line("HTTP/1.1 401 Unauthorized\n"); |
| 196 headers_with_status_line += tests[i].headers; | 202 headers_with_status_line += tests[i].headers; |
| 197 scoped_refptr<net::HttpResponseHeaders> headers( | 203 scoped_refptr<net::HttpResponseHeaders> headers( |
| 198 new net::HttpResponseHeaders( | 204 new net::HttpResponseHeaders( |
| 199 net::HttpUtil::AssembleRawHeaders( | 205 net::HttpUtil::AssembleRawHeaders( |
| 200 headers_with_status_line.c_str(), | 206 headers_with_status_line.c_str(), |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 std::string name; | 412 std::string name; |
| 407 | 413 |
| 408 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); | 414 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_SERVER); |
| 409 EXPECT_STREQ("Authorization", name.c_str()); | 415 EXPECT_STREQ("Authorization", name.c_str()); |
| 410 | 416 |
| 411 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); | 417 name = HttpAuth::GetAuthorizationHeaderName(HttpAuth::AUTH_PROXY); |
| 412 EXPECT_STREQ("Proxy-Authorization", name.c_str()); | 418 EXPECT_STREQ("Proxy-Authorization", name.c_str()); |
| 413 } | 419 } |
| 414 | 420 |
| 415 } // namespace net | 421 } // namespace net |
| OLD | NEW |