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

Unified Diff: net/http/http_auth_handler_ntlm.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: Reduce password zapping Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_auth_handler_ntlm.cc
diff --git a/net/http/http_auth_handler_ntlm.cc b/net/http/http_auth_handler_ntlm.cc
index 91fff6104a798c22ff4db8973d4f7e7ecafb4cc6..34b1b62e17cc8702900aaf1a8bbc1437e48c370b 100644
--- a/net/http/http_auth_handler_ntlm.cc
+++ b/net/http/http_auth_handler_ntlm.cc
@@ -29,20 +29,18 @@ bool HttpAuthHandlerNTLM::Init(HttpAuth::ChallengeTokenizer* tok) {
}
int HttpAuthHandlerNTLM::GenerateAuthTokenImpl(
- const string16* username,
- const string16* password,
+ const AuthCredentials* credentials,
const HttpRequestInfo* request,
OldCompletionCallback* callback,
std::string* auth_token) {
#if defined(NTLM_SSPI)
return auth_sspi_.GenerateAuthToken(
- username,
- password,
+ credentials,
CreateSPN(origin_),
auth_token);
#else // !defined(NTLM_SSPI)
// TODO(cbentzel): Shouldn't be hitting this case.
- if (!username || !password) {
+ if (!credentials) {
LOG(ERROR) << "Username and password are expected to be non-NULL.";
return ERR_MISSING_AUTH_CREDENTIALS;
}
@@ -58,17 +56,17 @@ int HttpAuthHandlerNTLM::GenerateAuthTokenImpl(
// components.
string16 domain;
string16 user;
+ const string16& username = credentials->username();
const char16 backslash_character = '\\';
- size_t backslash_idx = username->find(backslash_character);
+ size_t backslash_idx = username.find(backslash_character);
if (backslash_idx == string16::npos) {
- user = *username;
+ user = username;
} else {
- domain = username->substr(0, backslash_idx);
- user = username->substr(backslash_idx + 1);
+ domain = username.substr(0, backslash_idx);
+ user = username.substr(backslash_idx + 1);
}
domain_ = domain;
- username_ = user;
- password_ = *password;
+ credentials_.Set(user, credentials->password());
// Initial challenge.
if (auth_data_.empty()) {

Powered by Google App Engine
This is Rietveld 408576698