Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1028)

Unified Diff: net/http/http_auth.h

Issue 1157333005: [net/http auth] Use strings to identify authentication schemes. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/auth.h ('k') | net/http/http_auth.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth.h
diff --git a/net/http/http_auth.h b/net/http/http_auth.h
index 5a2c7ac6606e3353f4d32ab37a96b78760ba8a06..c259cf55c3f3a10bd488b62d05cb596656378a31 100644
--- a/net/http/http_auth.h
+++ b/net/http/http_auth.h
@@ -13,13 +13,12 @@
#include "net/base/net_export.h"
#include "net/http/http_util.h"
-template <class T> class scoped_refptr;
-
namespace net {
class BoundNetLog;
class HttpAuthHandler;
class HttpAuthHandlerFactory;
+class HttpAuthSchemeSet;
class HttpResponseHeaders;
// Utility class for http authentication.
@@ -87,28 +86,19 @@ class NET_EXPORT_PRIVATE HttpAuth {
IDENT_SRC_DEFAULT_CREDENTIALS,
};
- enum Scheme {
- AUTH_SCHEME_BASIC = 0,
- AUTH_SCHEME_DIGEST,
- AUTH_SCHEME_NTLM,
- AUTH_SCHEME_NEGOTIATE,
- AUTH_SCHEME_SPDYPROXY,
- AUTH_SCHEME_MOCK,
- AUTH_SCHEME_MAX,
- };
-
- // Helper structure used by HttpNetworkTransaction to track
- // the current identity being used for authorization.
+ // Helper structure used by HttpNetworkTransaction to track the current
+ // identity being used for authorization.
struct Identity {
Identity();
+ ~Identity();
IdentitySource source;
bool invalid;
AuthCredentials credentials;
};
- // Get the name of the header containing the auth challenge
- // (either WWW-Authenticate or Proxy-Authenticate).
+ // Get the name of the header containing the auth challenge (either
+ // WWW-Authenticate or Proxy-Authenticate).
static std::string GetChallengeHeaderName(Target target);
// Get the name of the header where the credentials go
@@ -119,12 +109,9 @@ class NET_EXPORT_PRIVATE HttpAuth {
// messages.
static std::string GetAuthTargetString(Target target);
- // Returns a string representation of an authentication Scheme.
- static const char* SchemeToString(Scheme scheme);
-
- // Iterate through the challenge headers, and pick the best one that
- // we support. Obtains the implementation class for handling the challenge,
- // and passes it back in |*handler|. If no supported challenge was found,
+ // Iterate through the challenge headers, and pick the best one that we
+ // support. Obtains the implementation class for handling the challenge, and
+ // passes it back in |*handler|. If no supported challenge was found,
// |*handler| is set to NULL.
//
// |disabled_schemes| is the set of schemes that we should not use.
@@ -136,7 +123,7 @@ class NET_EXPORT_PRIVATE HttpAuth {
const HttpResponseHeaders* headers,
Target target,
const GURL& origin,
- const std::set<Scheme>& disabled_schemes,
+ const HttpAuthSchemeSet& disabled_schemes,
const BoundNetLog& net_log,
scoped_ptr<HttpAuthHandler>* handler);
@@ -165,8 +152,12 @@ class NET_EXPORT_PRIVATE HttpAuth {
HttpAuthHandler* handler,
const HttpResponseHeaders* headers,
Target target,
- const std::set<Scheme>& disabled_schemes,
+ const HttpAuthSchemeSet& disabled_schemes,
std::string* challenge_used);
+
+ // RFC 7235 states that an authentication scheme is a case insensitive token.
+ // This function checks whether |scheme| is a token AND is lowercase.
+ static bool IsValidNormalizedScheme(const std::string& scheme);
};
} // namespace net
« no previous file with comments | « net/base/auth.h ('k') | net/http/http_auth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698