summaryrefslogtreecommitdiffstats
path: root/net/http/http_auth.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/http/http_auth.h')
-rw-r--r--net/http/http_auth.h35
1 files changed, 21 insertions, 14 deletions
diff --git a/net/http/http_auth.h b/net/http/http_auth.h
index 38c9918..76deca8 100644
--- a/net/http/http_auth.h
+++ b/net/http/http_auth.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -12,6 +12,7 @@ template <class T> class scoped_refptr;
namespace net {
class HttpAuthHandler;
+class HttpAuthHandlerFactory;
class HttpResponseHeaders;
// Utility class for http authentication.
@@ -70,14 +71,6 @@ class HttpAuth {
// (either Authorization or Proxy-Authorization).
static std::string GetAuthorizationHeaderName(Target target);
- // Create a handler to generate credentials for the challenge, and pass
- // it back in |*handler|. If the challenge is unsupported or invalid
- // |*handler| is set to NULL.
- static void CreateAuthHandler(const std::string& challenge,
- Target target,
- const GURL& origin,
- scoped_refptr<HttpAuthHandler>* handler);
-
// 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 the existing handler in |*handler|
@@ -91,10 +84,12 @@ class HttpAuth {
// TODO(wtc): Continuing to use the existing handler in |*handler| (for
// NTLM) is new behavior. Rename ChooseBestChallenge to fully encompass
// what it does now.
- static void ChooseBestChallenge(const HttpResponseHeaders* headers,
- Target target,
- const GURL& origin,
- scoped_refptr<HttpAuthHandler>* handler);
+ static void ChooseBestChallenge(
+ HttpAuthHandlerFactory* http_auth_handler_factory,
+ const HttpResponseHeaders* headers,
+ Target target,
+ const GURL& origin,
+ scoped_refptr<HttpAuthHandler>* handler);
// ChallengeTokenizer breaks up a challenge string into the the auth scheme
// and parameter list, according to RFC 2617 Sec 1.2:
@@ -107,7 +102,7 @@ class HttpAuth {
public:
ChallengeTokenizer(std::string::const_iterator begin,
std::string::const_iterator end)
- : props_(begin, end, ','), valid_(true) {
+ : props_(begin, end, ','), valid_(true), expect_base64_token_(false) {
Init(begin, end);
}
@@ -127,6 +122,17 @@ class HttpAuth {
// Returns true if there is none to consume.
bool GetNext();
+ // Inform the tokenizer whether the next token should be treated as a base64
+ // encoded value. If |expect_base64_token| is true, |GetNext| will treat the
+ // next token as a base64 encoded value, and will include the trailing '='
+ // padding rather than attempt to split the token into a name/value pair.
+ // In this case, |name| will be empty, and |value| will contain the token.
+ // Subsequent calls to |GetNext()| will not treat the token like a base64
+ // encoded token unless the caller again calls |set_expect_base64_token|.
+ void set_expect_base64_token(bool expect_base64_token) {
+ expect_base64_token_ = expect_base64_token;
+ }
+
// The name of the current name-value pair.
std::string::const_iterator name_begin() const { return name_begin_; }
std::string::const_iterator name_end() const { return name_end_; }
@@ -164,6 +170,7 @@ class HttpAuth {
std::string::const_iterator value_end_;
bool value_is_quoted_;
+ bool expect_base64_token_;
};
};