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

Side by Side Diff: net/http/http_auth_handler_basic.cc

Issue 28144: Implement the NTLM authentication scheme by porting... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Final upload before checkin Created 11 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth_handler.cc ('k') | net/http/http_auth_handler_digest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_auth_handler_basic.h" 5 #include "net/http/http_auth_handler_basic.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "net/http/http_auth.h" 8 #include "net/http/http_auth.h"
9 #include "net/base/base64.h" 9 #include "net/base/base64.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 bool HttpAuthHandlerBasic::Init(std::string::const_iterator challenge_begin, 13 bool HttpAuthHandlerBasic::Init(std::string::const_iterator challenge_begin,
14 std::string::const_iterator challenge_end) { 14 std::string::const_iterator challenge_end) {
15 scheme_ = "basic"; 15 scheme_ = "basic";
16 score_ = 1; 16 score_ = 1;
17 properties_ = 0;
17 18
18 // Verify the challenge's auth-scheme. 19 // Verify the challenge's auth-scheme.
19 HttpAuth::ChallengeTokenizer challenge_tok(challenge_begin, challenge_end); 20 HttpAuth::ChallengeTokenizer challenge_tok(challenge_begin, challenge_end);
20 if (!challenge_tok.valid() || 21 if (!challenge_tok.valid() ||
21 !LowerCaseEqualsASCII(challenge_tok.scheme(), "basic")) 22 !LowerCaseEqualsASCII(challenge_tok.scheme(), "basic"))
22 return false; 23 return false;
23 24
24 // Extract the realm. 25 // Extract the realm.
25 while (challenge_tok.GetNext()) { 26 while (challenge_tok.GetNext()) {
26 if (LowerCaseEqualsASCII(challenge_tok.name(), "realm")) 27 if (LowerCaseEqualsASCII(challenge_tok.name(), "realm"))
(...skipping 10 matching lines...) Expand all
37 const ProxyInfo*) { 38 const ProxyInfo*) {
38 // TODO(eroman): is this the right encoding of username/password? 39 // TODO(eroman): is this the right encoding of username/password?
39 std::string base64_username_password; 40 std::string base64_username_password;
40 if (!Base64Encode(WideToUTF8(username) + ":" + WideToUTF8(password), 41 if (!Base64Encode(WideToUTF8(username) + ":" + WideToUTF8(password),
41 &base64_username_password)) 42 &base64_username_password))
42 return std::string(); // FAIL 43 return std::string(); // FAIL
43 return std::string("Basic ") + base64_username_password; 44 return std::string("Basic ") + base64_username_password;
44 } 45 }
45 46
46 } // namespace net 47 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler.cc ('k') | net/http/http_auth_handler_digest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698