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

Side by Side Diff: net/http/http_auth_handler.h

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, 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 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_H_ 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_H_
6 #define NET_HTTP_HTTP_AUTH_HANDLER_H_ 6 #define NET_HTTP_HTTP_AUTH_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/string16.h" 11 #include "base/string16.h"
asanka 2011/10/28 14:39:40 Not needed?
12 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 #include "net/base/net_log.h" 14 #include "net/base/net_log.h"
15 #include "net/http/http_auth.h" 15 #include "net/http/http_auth.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 struct HttpRequestInfo; 19 struct HttpRequestInfo;
20 20
21 // HttpAuthHandler is the interface for the authentication schemes 21 // HttpAuthHandler is the interface for the authentication schemes
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // The return value is a net error code. 63 // The return value is a net error code.
64 // If |OK| is returned, |*auth_token| is filled in with an authentication 64 // If |OK| is returned, |*auth_token| is filled in with an authentication
65 // token which can be inserted in the HTTP request. 65 // token which can be inserted in the HTTP request.
66 // If |ERR_IO_PENDING| is returned, |*auth_token| will be filled in 66 // If |ERR_IO_PENDING| is returned, |*auth_token| will be filled in
67 // asynchronously and |callback| will be invoked. The lifetime of 67 // asynchronously and |callback| will be invoked. The lifetime of
68 // |request|, |callback|, and |auth_token| must last until |callback| is 68 // |request|, |callback|, and |auth_token| must last until |callback| is
69 // invoked, but |username| and |password| are only used during the initial 69 // invoked, but |username| and |password| are only used during the initial
70 // call. 70 // call.
71 // Otherwise, there was a problem generating a token synchronously, and the 71 // Otherwise, there was a problem generating a token synchronously, and the
72 // value of |*auth_token| is unspecified. 72 // value of |*auth_token| is unspecified.
73 int GenerateAuthToken(const string16* username, 73 int GenerateAuthToken(const AuthCredentials* credentials,
74 const string16* password,
75 const HttpRequestInfo* request, 74 const HttpRequestInfo* request,
76 OldCompletionCallback* callback, 75 OldCompletionCallback* callback,
77 std::string* auth_token); 76 std::string* auth_token);
78 77
79 // The authentication scheme as an enumerated value. 78 // The authentication scheme as an enumerated value.
80 HttpAuth::Scheme auth_scheme() const { 79 HttpAuth::Scheme auth_scheme() const {
81 return auth_scheme_; 80 return auth_scheme_;
82 } 81 }
83 82
84 // The realm, encoded as UTF-8. This may be empty. 83 // The realm, encoded as UTF-8. This may be empty.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // |challenge| must be non-NULL and have already tokenized the 149 // |challenge| must be non-NULL and have already tokenized the
151 // authentication scheme, but none of the tokens occuring after the 150 // authentication scheme, but none of the tokens occuring after the
152 // authentication scheme. 151 // authentication scheme.
153 // Implementations are expcted to initialize the following members: 152 // Implementations are expcted to initialize the following members:
154 // scheme_, realm_, score_, properties_ 153 // scheme_, realm_, score_, properties_
155 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge) = 0; 154 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge) = 0;
156 155
157 // |GenerateAuthTokenImpl()} is the auth-scheme specific implementation 156 // |GenerateAuthTokenImpl()} is the auth-scheme specific implementation
158 // of generating the next auth token. Callers sohuld use |GenerateAuthToken()| 157 // of generating the next auth token. Callers sohuld use |GenerateAuthToken()|
159 // which will in turn call |GenerateAuthTokenImpl()| 158 // which will in turn call |GenerateAuthTokenImpl()|
160 virtual int GenerateAuthTokenImpl(const string16* username, 159 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials,
161 const string16* password,
162 const HttpRequestInfo* request, 160 const HttpRequestInfo* request,
163 OldCompletionCallback* callback, 161 OldCompletionCallback* callback,
164 std::string* auth_token) = 0; 162 std::string* auth_token) = 0;
asanka 2011/10/28 14:39:40 It's probably worthwhile putting in OVERRIDEs for
cbentzel 2011/10/28 15:58:07 I agree to an extent - it's not as critical for ov
165 163
166 // The auth-scheme as an enumerated value. 164 // The auth-scheme as an enumerated value.
167 HttpAuth::Scheme auth_scheme_; 165 HttpAuth::Scheme auth_scheme_;
168 166
169 // The realm, encoded as UTF-8. Used by "basic" and "digest". 167 // The realm, encoded as UTF-8. Used by "basic" and "digest".
170 std::string realm_; 168 std::string realm_;
171 169
172 // The auth challenge. 170 // The auth challenge.
173 std::string auth_challenge_; 171 std::string auth_challenge_;
174 172
(...skipping 17 matching lines...) Expand all
192 void OnGenerateAuthTokenComplete(int rv); 190 void OnGenerateAuthTokenComplete(int rv);
193 void FinishGenerateAuthToken(); 191 void FinishGenerateAuthToken();
194 192
195 OldCompletionCallback* original_callback_; 193 OldCompletionCallback* original_callback_;
196 OldCompletionCallbackImpl<HttpAuthHandler> wrapper_callback_; 194 OldCompletionCallbackImpl<HttpAuthHandler> wrapper_callback_;
197 }; 195 };
198 196
199 } // namespace net 197 } // namespace net
200 198
201 #endif // NET_HTTP_HTTP_AUTH_HANDLER_H_ 199 #endif // NET_HTTP_HTTP_AUTH_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698