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

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: 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_gssapi_posix_unittest.cc ('k') | net/http/http_auth_handler.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) 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"
12 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
13 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
14 #include "net/base/net_log.h" 13 #include "net/base/net_log.h"
15 #include "net/http/http_auth.h" 14 #include "net/http/http_auth.h"
16 15
17 namespace net { 16 namespace net {
18 17
19 struct HttpRequestInfo; 18 struct HttpRequestInfo;
20 19
21 // HttpAuthHandler is the interface for the authentication schemes 20 // HttpAuthHandler is the interface for the authentication schemes
(...skipping 25 matching lines...) Expand all
47 // be made with a different nonce provided in the challenge. 46 // be made with a different nonce provided in the challenge.
48 // 47 //
49 // |challenge| must be non-NULL and have already tokenized the 48 // |challenge| must be non-NULL and have already tokenized the
50 // authentication scheme, but none of the tokens occuring after the 49 // authentication scheme, but none of the tokens occuring after the
51 // authentication scheme. 50 // authentication scheme.
52 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( 51 virtual HttpAuth::AuthorizationResult HandleAnotherChallenge(
53 HttpAuth::ChallengeTokenizer* challenge) = 0; 52 HttpAuth::ChallengeTokenizer* challenge) = 0;
54 53
55 // Generates an authentication token, potentially asynchronously. 54 // Generates an authentication token, potentially asynchronously.
56 // 55 //
57 // When |username| and |password| are NULL, the default credentials for 56 // When |credentials| is NULL, the default credentials for the currently
58 // the currently logged in user are used. |AllowsDefaultCredentials()| MUST be 57 // logged in user are used. |AllowsDefaultCredentials()| MUST be true in this
59 // true in this case. 58 // case.
60 // 59 //
61 // |request|, |callback|, and |auth_token| must be non-NULL. 60 // |request|, |callback|, and |auth_token| must be non-NULL.
62 // 61 //
63 // The return value is a net error code. 62 // The return value is a net error code.
63 //
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 //
66 // If |ERR_IO_PENDING| is returned, |*auth_token| will be filled in 67 // If |ERR_IO_PENDING| is returned, |*auth_token| will be filled in
67 // asynchronously and |callback| will be invoked. The lifetime of 68 // asynchronously and |callback| will be invoked. The lifetime of
68 // |request|, |callback|, and |auth_token| must last until |callback| is 69 // |request|, |callback|, and |auth_token| must last until |callback| is
69 // invoked, but |username| and |password| are only used during the initial 70 // invoked, but |credentials| is only used during the initial call.
70 // call. 71 //
71 // Otherwise, there was a problem generating a token synchronously, and the 72 // All other return codes indicate that there was a problem generating a
72 // value of |*auth_token| is unspecified. 73 // token, and the value of |*auth_token| is unspecified.
73 int GenerateAuthToken(const string16* username, 74 int GenerateAuthToken(const AuthCredentials* credentials,
74 const string16* password,
75 const HttpRequestInfo* request, 75 const HttpRequestInfo* request,
76 OldCompletionCallback* callback, 76 OldCompletionCallback* callback,
77 std::string* auth_token); 77 std::string* auth_token);
78 78
79 // The authentication scheme as an enumerated value. 79 // The authentication scheme as an enumerated value.
80 HttpAuth::Scheme auth_scheme() const { 80 HttpAuth::Scheme auth_scheme() const {
81 return auth_scheme_; 81 return auth_scheme_;
82 } 82 }
83 83
84 // The realm, encoded as UTF-8. This may be empty. 84 // 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 150 // |challenge| must be non-NULL and have already tokenized the
151 // authentication scheme, but none of the tokens occuring after the 151 // authentication scheme, but none of the tokens occuring after the
152 // authentication scheme. 152 // authentication scheme.
153 // Implementations are expcted to initialize the following members: 153 // Implementations are expcted to initialize the following members:
154 // scheme_, realm_, score_, properties_ 154 // scheme_, realm_, score_, properties_
155 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge) = 0; 155 virtual bool Init(HttpAuth::ChallengeTokenizer* challenge) = 0;
156 156
157 // |GenerateAuthTokenImpl()} is the auth-scheme specific implementation 157 // |GenerateAuthTokenImpl()} is the auth-scheme specific implementation
158 // of generating the next auth token. Callers sohuld use |GenerateAuthToken()| 158 // of generating the next auth token. Callers sohuld use |GenerateAuthToken()|
159 // which will in turn call |GenerateAuthTokenImpl()| 159 // which will in turn call |GenerateAuthTokenImpl()|
160 virtual int GenerateAuthTokenImpl(const string16* username, 160 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials,
161 const string16* password,
162 const HttpRequestInfo* request, 161 const HttpRequestInfo* request,
163 OldCompletionCallback* callback, 162 OldCompletionCallback* callback,
164 std::string* auth_token) = 0; 163 std::string* auth_token) = 0;
165 164
166 // The auth-scheme as an enumerated value. 165 // The auth-scheme as an enumerated value.
167 HttpAuth::Scheme auth_scheme_; 166 HttpAuth::Scheme auth_scheme_;
168 167
169 // The realm, encoded as UTF-8. Used by "basic" and "digest". 168 // The realm, encoded as UTF-8. Used by "basic" and "digest".
170 std::string realm_; 169 std::string realm_;
171 170
(...skipping 20 matching lines...) Expand all
192 void OnGenerateAuthTokenComplete(int rv); 191 void OnGenerateAuthTokenComplete(int rv);
193 void FinishGenerateAuthToken(); 192 void FinishGenerateAuthToken();
194 193
195 OldCompletionCallback* original_callback_; 194 OldCompletionCallback* original_callback_;
196 OldCompletionCallbackImpl<HttpAuthHandler> wrapper_callback_; 195 OldCompletionCallbackImpl<HttpAuthHandler> wrapper_callback_;
197 }; 196 };
198 197
199 } // namespace net 198 } // namespace net
200 199
201 #endif // NET_HTTP_HTTP_AUTH_HANDLER_H_ 200 #endif // NET_HTTP_HTTP_AUTH_HANDLER_H_
OLDNEW
« no previous file with comments | « net/http/http_auth_gssapi_posix_unittest.cc ('k') | net/http/http_auth_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698