From 9bd3095ca43167be01c25cd79c2e7c21529ed153 Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Fri, 20 May 2011 19:09:50 +0000 Subject: net: Add NET_API to the auth code. BUG=76997 TEST=NONE Review URL: http://codereview.chromium.org/7016043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86128 0039d316-1c4b-4281-b951-d872f2087c98 --- net/http/des.h | 7 ++++--- net/http/http_auth.h | 5 +++-- net/http/http_auth_cache.h | 5 +++-- net/http/http_auth_controller.h | 6 ++++-- net/http/http_auth_filter.h | 7 ++++--- net/http/http_auth_handler.h | 5 +++-- net/http/http_auth_handler_basic.h | 7 ++++--- net/http/http_auth_handler_digest.h | 9 +++++---- net/http/http_auth_handler_factory.h | 5 +++-- net/http/http_auth_handler_negotiate.h | 7 ++++--- net/http/http_auth_sspi_win.h | 17 +++++++++-------- net/http/http_mac_signature.h | 3 ++- net/http/url_security_manager.h | 3 ++- 13 files changed, 50 insertions(+), 36 deletions(-) (limited to 'net/http') diff --git a/net/http/des.h b/net/http/des.h index 94a4f7c..5ae4916 100644 --- a/net/http/des.h +++ b/net/http/des.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #pragma once #include "base/basictypes.h" +#include "net/base/net_api.h" namespace net { @@ -16,12 +17,12 @@ namespace net { // TODO(wtc): Turn this into a C++ API and move it to the base module. // Build a 64-bit DES key from a 56-bit raw key. -void DESMakeKey(const uint8* raw, uint8* key); +NET_TEST void DESMakeKey(const uint8* raw, uint8* key); // Run the DES encryption algorithm in ECB mode on one block (8 bytes) of // data. |key| is a DES key (8 bytes), |src| is the input plaintext (8 // bytes), and |hash| is an 8-byte buffer receiving the output ciphertext. -void DESEncrypt(const uint8* key, const uint8* src, uint8* hash); +NET_TEST void DESEncrypt(const uint8* key, const uint8* src, uint8* hash); } // namespace net diff --git a/net/http/http_auth.h b/net/http/http_auth.h index 99c3c81..4a89a60 100644 --- a/net/http/http_auth.h +++ b/net/http/http_auth.h @@ -11,6 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "base/string16.h" +#include "net/base/net_api.h" #include "net/http/http_util.h" template class scoped_refptr; @@ -23,7 +24,7 @@ class HttpAuthHandlerFactory; class HttpResponseHeaders; // Utility class for http authentication. -class HttpAuth { +class NET_TEST HttpAuth { public: // Http authentication can be done the the proxy server, origin server, // or both. This enum tracks who the target is. @@ -176,7 +177,7 @@ class HttpAuth { // parameters as either a base-64 encoded string or a comma-delimited list // of name-value pairs. param_pairs() and base64_param() methods are provided // to support either usage. - class ChallengeTokenizer { + class NET_TEST ChallengeTokenizer { public: ChallengeTokenizer(std::string::const_iterator begin, std::string::const_iterator end) diff --git a/net/http/http_auth_cache.h b/net/http/http_auth_cache.h index e8f7f16..e7eb305 100644 --- a/net/http/http_auth_cache.h +++ b/net/http/http_auth_cache.h @@ -13,6 +13,7 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" #include "googleurl/src/gurl.h" +#include "net/base/net_api.h" #include "net/http/http_auth.h" namespace net { @@ -25,7 +26,7 @@ namespace net { // - the last auth handler used (contains realm and authentication scheme) // - the list of paths which used this realm // Entries can be looked up by either (origin, realm, scheme) or (origin, path). -class HttpAuthCache { +class NET_TEST HttpAuthCache { public: class Entry; @@ -108,7 +109,7 @@ class HttpAuthCache { }; // An authentication realm entry. -class HttpAuthCache::Entry { +class NET_TEST HttpAuthCache::Entry { public: ~Entry(); diff --git a/net/http/http_auth_controller.h b/net/http/http_auth_controller.h index 8fed8c8..cd3de04 100644 --- a/net/http/http_auth_controller.h +++ b/net/http/http_auth_controller.h @@ -16,6 +16,7 @@ #include "base/threading/non_thread_safe.h" #include "googleurl/src/gurl.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" #include "net/base/net_log.h" #include "net/http/http_auth.h" @@ -28,8 +29,9 @@ class HttpAuthCache; class HttpRequestHeaders; struct HttpRequestInfo; -class HttpAuthController : public base::RefCounted, - public base::NonThreadSafe { +class NET_TEST HttpAuthController + : public base::RefCounted, + NON_EXPORTED_BASE(public base::NonThreadSafe) { public: // The arguments are self explanatory except possibly for |auth_url|, which // should be both the auth target and auth path in a single url argument. diff --git a/net/http/http_auth_filter.h b/net/http/http_auth_filter.h index 81d414c..108a72c 100644 --- a/net/http/http_auth_filter.h +++ b/net/http/http_auth_filter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include #include +#include "net/base/net_api.h" #include "net/http/http_auth.h" #include "net/proxy/proxy_bypass_rules.h" @@ -18,7 +19,7 @@ namespace net { // |HttpAuthFilter|s determine whether an authentication scheme should be // allowed for a particular peer. -class HttpAuthFilter { +class NET_TEST HttpAuthFilter { public: virtual ~HttpAuthFilter() {} @@ -32,7 +33,7 @@ class HttpAuthFilter { // // Uses the ProxyBypassRules class to do whitelisting for servers. // All proxies are allowed. -class HttpAuthFilterWhitelist : public HttpAuthFilter { +class NET_API HttpAuthFilterWhitelist : public HttpAuthFilter { public: explicit HttpAuthFilterWhitelist(const std::string& server_whitelist); virtual ~HttpAuthFilterWhitelist(); diff --git a/net/http/http_auth_handler.h b/net/http/http_auth_handler.h index 0a574e5..4065de5 100644 --- a/net/http/http_auth_handler.h +++ b/net/http/http_auth_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ #include "base/string16.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" #include "net/base/net_log.h" #include "net/http/http_auth.h" @@ -20,7 +21,7 @@ struct HttpRequestInfo; // HttpAuthHandler is the interface for the authentication schemes // (basic, digest, NTLM, Negotiate). // HttpAuthHandler objects are typically created by an HttpAuthHandlerFactory. -class HttpAuthHandler { +class NET_TEST HttpAuthHandler { public: HttpAuthHandler(); virtual ~HttpAuthHandler(); diff --git a/net/http/http_auth_handler_basic.h b/net/http/http_auth_handler_basic.h index a48c5d8..b98c7fd 100644 --- a/net/http/http_auth_handler_basic.h +++ b/net/http/http_auth_handler_basic.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,15 +9,16 @@ #include #include "base/string16.h" +#include "net/base/net_api.h" #include "net/http/http_auth_handler.h" #include "net/http/http_auth_handler_factory.h" namespace net { // Code for handling http basic authentication. -class HttpAuthHandlerBasic : public HttpAuthHandler { +class NET_TEST HttpAuthHandlerBasic : public HttpAuthHandler { public: - class Factory : public HttpAuthHandlerFactory { + class NET_TEST Factory : public HttpAuthHandlerFactory { public: Factory(); virtual ~Factory(); diff --git a/net/http/http_auth_handler_digest.h b/net/http/http_auth_handler_digest.h index f279b65..a9bf0ec 100644 --- a/net/http/http_auth_handler_digest.h +++ b/net/http/http_auth_handler_digest.h @@ -12,18 +12,19 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/string16.h" +#include "net/base/net_api.h" #include "net/http/http_auth_handler.h" #include "net/http/http_auth_handler_factory.h" namespace net { // Code for handling http digest authentication. -class HttpAuthHandlerDigest : public HttpAuthHandler { +class NET_TEST HttpAuthHandlerDigest : public HttpAuthHandler { public: // A NonceGenerator is a simple interface for generating client nonces. // Unit tests can override the default client nonce behavior with fixed // nonce generation to get reproducible results. - class NonceGenerator { + class NET_TEST NonceGenerator { public: NonceGenerator(); virtual ~NonceGenerator(); @@ -46,7 +47,7 @@ class HttpAuthHandlerDigest : public HttpAuthHandler { // FixedNonceGenerator always uses the same string specified at // construction time as the client nonce. - class FixedNonceGenerator : public NonceGenerator { + class NET_TEST FixedNonceGenerator : public NonceGenerator { public: explicit FixedNonceGenerator(const std::string& nonce); @@ -57,7 +58,7 @@ class HttpAuthHandlerDigest : public HttpAuthHandler { DISALLOW_COPY_AND_ASSIGN(FixedNonceGenerator); }; - class Factory : public HttpAuthHandlerFactory { + class NET_TEST Factory : public HttpAuthHandlerFactory { public: Factory(); virtual ~Factory(); diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h index c5cf98e..d8cfa1e 100644 --- a/net/http/http_auth_handler_factory.h +++ b/net/http/http_auth_handler_factory.h @@ -11,6 +11,7 @@ #include #include "base/memory/scoped_ptr.h" +#include "net/base/net_api.h" #include "net/http/http_auth.h" #include "net/http/url_security_manager.h" @@ -26,7 +27,7 @@ class HttpAuthHandlerRegistryFactory; // An HttpAuthHandlerFactory is used to create HttpAuthHandler objects. // The HttpAuthHandlerFactory object _must_ outlive any of the HttpAuthHandler // objects that it creates. -class HttpAuthHandlerFactory { +class NET_API HttpAuthHandlerFactory { public: enum CreateReason { CREATE_CHALLENGE, // Create a handler in response to a challenge. @@ -125,7 +126,7 @@ class HttpAuthHandlerFactory { // The HttpAuthHandlerRegistryFactory dispatches create requests out // to other factories based on the auth scheme. -class HttpAuthHandlerRegistryFactory : public HttpAuthHandlerFactory { +class NET_API HttpAuthHandlerRegistryFactory : public HttpAuthHandlerFactory { public: HttpAuthHandlerRegistryFactory(); virtual ~HttpAuthHandlerRegistryFactory(); diff --git a/net/http/http_auth_handler_negotiate.h b/net/http/http_auth_handler_negotiate.h index de2a6e6..240903f 100644 --- a/net/http/http_auth_handler_negotiate.h +++ b/net/http/http_auth_handler_negotiate.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,6 +11,7 @@ #include "base/string16.h" #include "build/build_config.h" #include "net/base/address_list.h" +#include "net/base/net_api.h" #include "net/http/http_auth_handler.h" #include "net/http/http_auth_handler_factory.h" @@ -31,7 +32,7 @@ class URLSecurityManager; // See http://tools.ietf.org/html/rfc4178 and http://tools.ietf.org/html/rfc4559 // for more information about the protocol. -class HttpAuthHandlerNegotiate : public HttpAuthHandler { +class NET_TEST HttpAuthHandlerNegotiate : public HttpAuthHandler { public: #if defined(OS_WIN) typedef SSPILibrary AuthLibrary; @@ -41,7 +42,7 @@ class HttpAuthHandlerNegotiate : public HttpAuthHandler { typedef HttpAuthGSSAPI AuthSystem; #endif - class Factory : public HttpAuthHandlerFactory { + class NET_TEST Factory : public HttpAuthHandlerFactory { public: Factory(); virtual ~Factory(); diff --git a/net/http/http_auth_sspi_win.h b/net/http/http_auth_sspi_win.h index f56df8e..76e33c0 100644 --- a/net/http/http_auth_sspi_win.h +++ b/net/http/http_auth_sspi_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,6 +18,7 @@ #include #include "base/string16.h" +#include "net/base/net_api.h" #include "net/http/http_auth.h" namespace net { @@ -121,7 +122,7 @@ class SSPILibraryDefault : public SSPILibrary { } }; -class HttpAuthSSPI { +class NET_TEST HttpAuthSSPI { public: HttpAuthSSPI(SSPILibrary* sspi_library, const std::string& scheme, @@ -180,9 +181,9 @@ class HttpAuthSSPI { // If |combined| is of form "bar", |domain| will be empty and |user| will // contain "bar". // |domain| and |user| must be non-NULL. -void SplitDomainAndUser(const string16& combined, - string16* domain, - string16* user); +NET_TEST void SplitDomainAndUser(const string16& combined, + string16* domain, + string16* user); // Determines the maximum token length in bytes for a particular SSPI package. // @@ -198,9 +199,9 @@ void SplitDomainAndUser(const string16& combined, // If the return value is ERR_UNEXPECTED, there was an unanticipated problem // in the underlying SSPI call. The details are logged, and |*max_token_length| // is not changed. -int DetermineMaxTokenLength(SSPILibrary* library, - const std::wstring& package, - ULONG* max_token_length); +NET_TEST int DetermineMaxTokenLength(SSPILibrary* library, + const std::wstring& package, + ULONG* max_token_length); } // namespace net diff --git a/net/http/http_mac_signature.h b/net/http/http_mac_signature.h index 016fd3d..00191e1 100644 --- a/net/http/http_mac_signature.h +++ b/net/http/http_mac_signature.h @@ -12,6 +12,7 @@ #include "base/gtest_prod_util.h" #include "base/time.h" #include "crypto/hmac.h" +#include "net/base/net_api.h" namespace net { @@ -21,7 +22,7 @@ namespace net { // // http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token // -class HttpMacSignature { +class NET_TEST HttpMacSignature { public: HttpMacSignature(); ~HttpMacSignature(); diff --git a/net/http/url_security_manager.h b/net/http/url_security_manager.h index 2692252..571a1ba 100644 --- a/net/http/url_security_manager.h +++ b/net/http/url_security_manager.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +#include "net/base/net_api.h" class GURL; @@ -17,7 +18,7 @@ class HttpAuthFilter; // The URL security manager controls the policies (allow, deny, prompt user) // regarding URL actions (e.g., sending the default credentials to a server). -class URLSecurityManager { +class NET_API URLSecurityManager { public: URLSecurityManager() {} virtual ~URLSecurityManager() {} -- cgit v1.1