From c3b35c2100dba30c517116bc9a5a4e4149c3a8e5 Mon Sep 17 00:00:00 2001 From: "ericroman@google.com" Date: Sat, 27 Sep 2008 03:19:42 +0000 Subject: Initial stab at http authentication (basic + digest) in new http stack. General design: - class HttpAuth -- utility class for http-auth logic. - class HttpAuth::ChallengeTokenizer -- parsing of www-Authenticate headers. - class HttpAuthHandler -- base class for authentication schemes (inspired by nsIHttpAuthenticator) - class HttpAuthHandlerBasic : HttpAuthHandler -- logic for basic auth. - class HttpAuthHandlerDigest : HttpAuthHandler -- logic for digest auth. - The auth integration in HttpNetworkTransaction mimics that of HttpTransactionWinHttp: + HttpNetworkTransaction::ApplyAuth() -- set the authorization headers. + HttpNetworkTransaction::PopulateAuthChallenge() -- process the challenges. BUG=2346 Review URL: http://codereview.chromium.org/4063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2658 0039d316-1c4b-4281-b951-d872f2087c98 --- net/http/http_auth_handler.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 net/http/http_auth_handler.cc (limited to 'net/http/http_auth_handler.cc') diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc new file mode 100644 index 0000000..b0a7b97 --- /dev/null +++ b/net/http/http_auth_handler.cc @@ -0,0 +1,27 @@ +// Copyright (c) 2006-2008 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. + +#include "base/logging.h" +#include "net/http/http_auth_handler.h" + +namespace net { + +bool HttpAuthHandler::InitFromChallenge(std::string::const_iterator begin, + std::string::const_iterator end, + HttpAuth::Target target) { + target_ = target; + score_ = -1; + scheme_ = NULL; + + bool ok = Init(begin, end); + + // Init() is expected to set the scheme, realm, and score. + DCHECK(!ok || !scheme().empty()); + DCHECK(!ok || !realm().empty()); + DCHECK(!ok || score_ != -1); + + return ok; +} + +} // namespace net -- cgit v1.1