From 547fc79ddbed132ba12797c4f0e0aeecd3b63b8f Mon Sep 17 00:00:00 2001 From: "cbentzel@chromium.org" Date: Thu, 13 Jan 2011 13:31:17 +0000 Subject: Cleanup: Use AUTH_SCHEME enum instead of a string. BUG=None TEST=trybots Review URL: http://codereview.chromium.org/6191001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71318 0039d316-1c4b-4281-b951-d872f2087c98 --- net/http/http_auth_cache.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'net/http/http_auth_cache.h') diff --git a/net/http/http_auth_cache.h b/net/http/http_auth_cache.h index b6c382c..ecdcb35 100644 --- a/net/http/http_auth_cache.h +++ b/net/http/http_auth_cache.h @@ -13,6 +13,7 @@ #include "base/ref_counted.h" #include "base/string16.h" #include "googleurl/src/gurl.h" +#include "net/http/http_auth.h" namespace net { @@ -42,10 +43,11 @@ class HttpAuthCache { // scheme |scheme|. // |origin| - the {scheme, host, port} of the server. // |realm| - case sensitive realm string. - // |scheme| - case sensitive authentication scheme, should be lower-case. + // |scheme| - the authentication scheme (i.e. basic, negotiate). // returns - the matched entry or NULL. - Entry* Lookup(const GURL& origin, const std::string& realm, - const std::string& scheme); + Entry* Lookup(const GURL& origin, + const std::string& realm, + HttpAuth::Scheme scheme); // Find the entry on server |origin| whose protection space includes // |path|. This uses the assumption in RFC 2617 section 2 that deeper @@ -62,7 +64,7 @@ class HttpAuthCache { // paths list. // |origin| - the {scheme, host, port} of the server. // |realm| - the auth realm for the challenge. - // |scheme| - the authentication scheme for the challenge. + // |scheme| - the authentication scheme (i.e. basic, negotiate). // |username| - login information for the realm. // |password| - login information for the realm. // |path| - absolute path for a resource contained in the protection @@ -70,7 +72,7 @@ class HttpAuthCache { // returns - the entry that was just added/updated. Entry* Add(const GURL& origin, const std::string& realm, - const std::string& scheme, + HttpAuth::Scheme scheme, const std::string& auth_challenge, const string16& username, const string16& password, @@ -80,13 +82,13 @@ class HttpAuthCache { // if one exists AND if the cached identity matches (|username|, |password|). // |origin| - the {scheme, host, port} of the server. // |realm| - case sensitive realm string. - // |scheme| - authentication scheme + // |scheme| - the authentication scheme (i.e. basic, negotiate). // |username| - condition to match. // |password| - condition to match. // returns - true if an entry was removed. bool Remove(const GURL& origin, const std::string& realm, - const std::string& scheme, + HttpAuth::Scheme scheme, const string16& username, const string16& password); @@ -97,7 +99,7 @@ class HttpAuthCache { // cache, false otherwise. bool UpdateStaleChallenge(const GURL& origin, const std::string& realm, - const std::string& scheme, + HttpAuth::Scheme scheme, const std::string& auth_challenge); private: @@ -119,8 +121,8 @@ class HttpAuthCache::Entry { return realm_; } - // The authentication scheme string of the challenge - const std::string scheme() const { + // The authentication scheme of the challenge. + const HttpAuth::Scheme scheme() const { return scheme_; } @@ -161,10 +163,10 @@ class HttpAuthCache::Entry { // Returns true if |dir| is contained within the realm's protection space. bool HasEnclosingPath(const std::string& dir); - // |origin_| contains the {scheme, host, port} of the server. + // |origin_| contains the {protocol, host, port} of the server. GURL origin_; std::string realm_; - std::string scheme_; + HttpAuth::Scheme scheme_; // Identity. std::string auth_challenge_; -- cgit v1.1