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

Side by Side Diff: net/http/http_auth_handler.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: Fix comments 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
« no previous file with comments | « net/http/http_auth_handler.h ('k') | net/http/http_auth_handler_basic.h » ('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) 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/http/http_auth_handler.h" 5 #include "net/http/http_auth_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 case HttpAuth::AUTH_SERVER: 55 case HttpAuth::AUTH_SERVER:
56 return NetLog::TYPE_AUTH_SERVER; 56 return NetLog::TYPE_AUTH_SERVER;
57 default: 57 default:
58 NOTREACHED(); 58 NOTREACHED();
59 return NetLog::TYPE_CANCELLED; 59 return NetLog::TYPE_CANCELLED;
60 } 60 }
61 } 61 }
62 62
63 } // namespace 63 } // namespace
64 64
65 int HttpAuthHandler::GenerateAuthToken(const string16* username, 65 int HttpAuthHandler::GenerateAuthToken(const AuthCredentials* credentials,
66 const string16* password,
67 const HttpRequestInfo* request, 66 const HttpRequestInfo* request,
68 OldCompletionCallback* callback, 67 OldCompletionCallback* callback,
69 std::string* auth_token) { 68 std::string* auth_token) {
70 // TODO(cbentzel): Enforce non-NULL callback after cleaning up SocketStream. 69 // TODO(cbentzel): Enforce non-NULL callback after cleaning up SocketStream.
71 DCHECK(request); 70 DCHECK(request);
72 DCHECK((username == NULL) == (password == NULL)); 71 DCHECK(credentials != NULL || AllowsDefaultCredentials());
73 DCHECK(username != NULL || AllowsDefaultCredentials());
74 DCHECK(auth_token != NULL); 72 DCHECK(auth_token != NULL);
75 DCHECK(original_callback_ == NULL); 73 DCHECK(original_callback_ == NULL);
76 original_callback_ = callback; 74 original_callback_ = callback;
77 net_log_.BeginEvent(EventTypeFromAuthTarget(target_), NULL); 75 net_log_.BeginEvent(EventTypeFromAuthTarget(target_), NULL);
78 int rv = GenerateAuthTokenImpl(username, password, request, 76 int rv = GenerateAuthTokenImpl(credentials, request,
79 &wrapper_callback_, auth_token); 77 &wrapper_callback_, auth_token);
80 if (rv != ERR_IO_PENDING) 78 if (rv != ERR_IO_PENDING)
81 FinishGenerateAuthToken(); 79 FinishGenerateAuthToken();
82 return rv; 80 return rv;
83 } 81 }
84 82
85 bool HttpAuthHandler::NeedsIdentity() { 83 bool HttpAuthHandler::NeedsIdentity() {
86 return true; 84 return true;
87 } 85 }
88 86
(...skipping 12 matching lines...) Expand all
101 callback->Run(rv); 99 callback->Run(rv);
102 } 100 }
103 101
104 void HttpAuthHandler::FinishGenerateAuthToken() { 102 void HttpAuthHandler::FinishGenerateAuthToken() {
105 // TOOD(cbentzel): Should this be done in OK case only? 103 // TOOD(cbentzel): Should this be done in OK case only?
106 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL); 104 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL);
107 original_callback_ = NULL; 105 original_callback_ = NULL;
108 } 106 }
109 107
110 } // namespace net 108 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler.h ('k') | net/http/http_auth_handler_basic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698