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

Side by Side Diff: net/base/auth.cc

Issue 8340026: Use AuthCredentials throughout the network stack instead of username/password. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: mac compile fix Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base/auth.h" 5 #include "net/base/auth.h"
6 #include "net/base/zap.h"
6 7
7 namespace net { 8 namespace net {
8 9
9 AuthChallengeInfo::AuthChallengeInfo() : is_proxy(false) { 10 AuthChallengeInfo::AuthChallengeInfo() : is_proxy(false) {
10 } 11 }
11 12
12 bool AuthChallengeInfo::Equals(const AuthChallengeInfo& that) const { 13 bool AuthChallengeInfo::Equals(const AuthChallengeInfo& that) const {
13 return (this->is_proxy == that.is_proxy && 14 return (this->is_proxy == that.is_proxy &&
14 this->challenger.Equals(that.challenger) && 15 this->challenger.Equals(that.challenger) &&
15 this->scheme == that.scheme && 16 this->scheme == that.scheme &&
16 this->realm == that.realm); 17 this->realm == that.realm);
17 } 18 }
18 19
19 AuthChallengeInfo::~AuthChallengeInfo() { 20 AuthChallengeInfo::~AuthChallengeInfo() {
20 } 21 }
21 22
22 AuthData::AuthData() : state(AUTH_STATE_NEED_AUTH) { 23 AuthData::AuthData() : state(AUTH_STATE_NEED_AUTH) {
23 } 24 }
24 25
25 AuthData::~AuthData() { 26 AuthData::~AuthData() {
26 } 27 }
27 28
28 AuthCredentials::AuthCredentials() { 29 AuthCredentials::AuthCredentials() {
29 } 30 }
30 31
32 AuthCredentials::AuthCredentials(const string16& username,
33 const string16& password)
34 : username_(username),
35 password_(password) {
36 }
37
31 AuthCredentials::~AuthCredentials() { 38 AuthCredentials::~AuthCredentials() {
39 // Wipe our copy of the password from memory, to reduce the chance of being
40 // written to the paging file on disk.
41 ZapString(&password_);
42 }
43
44 bool AuthCredentials::Equals(const AuthCredentials& other) const {
45 return username_ == other.username_ && password_ == other.password_;
46 }
47
48 bool AuthCredentials::Empty() const {
49 return username_.empty() && password_.empty();
50 }
51
52 void AuthCredentials::Set(const string16& username, const string16& password) {
53 username_ = username;
54 password_ = password;
asanka 2011/10/27 20:01:20 Zap password_ before assignment? Also consider as
cbentzel 2011/10/28 02:18:40 As we discussed, I'll change behavior in another C
32 } 55 }
33 56
34 } // namespace net 57 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698