diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 19:13:29 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 19:13:29 +0000 |
commit | ac3fa8e2ef53e83b113d726209525f4af4aa46f1 (patch) | |
tree | cf3550a3155d263943062b68ea5b205035d22182 /net/http/http_auth_handler_basic.cc | |
parent | 5502208efd91894a34ef43a38d348b7f9acb3770 (diff) | |
download | chromium_src-ac3fa8e2ef53e83b113d726209525f4af4aa46f1.zip chromium_src-ac3fa8e2ef53e83b113d726209525f4af4aa46f1.tar.gz chromium_src-ac3fa8e2ef53e83b113d726209525f4af4aa46f1.tar.bz2 |
Add Single Sign On support to HTTP Authentication handlers.
Currently this is implemented on Windows for the NTLM and Negotiate schemes.
This CL does not introduce the hooks to actually use Single Sign On in response to a 401/407 request - that will come in a later CL.
This behavior is disabled for now as well.
BUG=29862
TEST=Ran unittests, and Chrome against a server with authentication challenges.
Review URL: http://codereview.chromium.org/555174
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_handler_basic.cc')
-rw-r--r-- | net/http/http_auth_handler_basic.cc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/net/http/http_auth_handler_basic.cc b/net/http/http_auth_handler_basic.cc index 71c310c..2c70577 100644 --- a/net/http/http_auth_handler_basic.cc +++ b/net/http/http_auth_handler_basic.cc @@ -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. @@ -8,6 +8,7 @@ #include "base/base64.h" #include "base/string_util.h" +#include "net/base/net_errors.h" #include "net/http/http_auth.h" namespace net { @@ -41,17 +42,31 @@ bool HttpAuthHandlerBasic::Init(std::string::const_iterator challenge_begin, return challenge_tok.valid(); } -std::string HttpAuthHandlerBasic::GenerateCredentials( +int HttpAuthHandlerBasic::GenerateAuthToken( const std::wstring& username, const std::wstring& password, const HttpRequestInfo*, - const ProxyInfo*) { + const ProxyInfo*, + std::string* auth_token) { // TODO(eroman): is this the right encoding of username/password? std::string base64_username_password; if (!base::Base64Encode(WideToUTF8(username) + ":" + WideToUTF8(password), - &base64_username_password)) - return std::string(); // FAIL - return std::string("Basic ") + base64_username_password; + &base64_username_password)) { + LOG(ERROR) << "Unexpected problem Base64 encoding."; + return ERR_UNEXPECTED; + } + *auth_token = "Basic " + base64_username_password; + return OK; +} + +int HttpAuthHandlerBasic::GenerateDefaultAuthToken( + const HttpRequestInfo* request, + const ProxyInfo* proxy, + std::string* auth_token) { + NOTREACHED(); + LOG(ERROR) << ErrorToString(ERR_NOT_IMPLEMENTED); + return ERR_NOT_IMPLEMENTED; } + } // namespace net |