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

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

Issue 1408433006: Support tls-server-end-point channel bindings for HTTP authentication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Narrower dependencies, update comments, address review comments. Created 4 years, 9 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 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 7
8 #include <string> 8 #include <string>
9 9
10 #include "net/base/completion_callback.h" 10 #include "net/base/completion_callback.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/http/http_auth.h" 12 #include "net/http/http_auth.h"
13 #include "net/log/net_log.h" 13 #include "net/log/net_log.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class HttpAuthChallengeTokenizer; 17 class HttpAuthChallengeTokenizer;
18 struct HttpRequestInfo; 18 struct HttpRequestInfo;
19 class SSLInfo;
19 20
20 // HttpAuthHandler is the interface for the authentication schemes 21 // HttpAuthHandler is the interface for the authentication schemes
21 // (basic, digest, NTLM, Negotiate). 22 // (basic, digest, NTLM, Negotiate).
22 // HttpAuthHandler objects are typically created by an HttpAuthHandlerFactory. 23 // HttpAuthHandler objects are typically created by an HttpAuthHandlerFactory.
23 class NET_EXPORT_PRIVATE HttpAuthHandler { 24 class NET_EXPORT_PRIVATE HttpAuthHandler {
24 public: 25 public:
25 HttpAuthHandler(); 26 HttpAuthHandler();
26 virtual ~HttpAuthHandler(); 27 virtual ~HttpAuthHandler();
27 28
28 // Initializes the handler using a challenge issued by a server. 29 // Initializes the handler using a challenge issued by a server.
29 // |challenge| must be non-NULL and have already tokenized the 30 // |challenge| must be non-NULL and have already tokenized the
30 // authentication scheme, but none of the tokens occurring after the 31 // authentication scheme, but none of the tokens occurring after the
31 // authentication scheme. |target| and |origin| are both stored 32 // authentication scheme. |target| and |origin| are both stored
32 // for later use, and are not part of the initial challenge. 33 // for later use, and are not part of the initial challenge.
33 bool InitFromChallenge(HttpAuthChallengeTokenizer* challenge, 34 bool InitFromChallenge(HttpAuthChallengeTokenizer* challenge,
34 HttpAuth::Target target, 35 HttpAuth::Target target,
36 const SSLInfo& ssl_info,
35 const GURL& origin, 37 const GURL& origin,
36 const BoundNetLog& net_log); 38 const BoundNetLog& net_log);
37 39
38 // Determines how the previous authorization attempt was received. 40 // Determines how the previous authorization attempt was received.
39 // 41 //
40 // This is called when the server/proxy responds with a 401/407 after an 42 // This is called when the server/proxy responds with a 401/407 after an
41 // earlier authorization attempt. Although this normally means that the 43 // earlier authorization attempt. Although this normally means that the
42 // previous attempt was rejected, in multi-round schemes such as 44 // previous attempt was rejected, in multi-round schemes such as
43 // NTLM+Negotiate it may indicate that another round of challenge+response 45 // NTLM+Negotiate it may indicate that another round of challenge+response
44 // is required. For Digest authentication it may also mean that the previous 46 // is required. For Digest authentication it may also mean that the previous
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 protected: 143 protected:
142 enum Property { 144 enum Property {
143 ENCRYPTS_IDENTITY = 1 << 0, 145 ENCRYPTS_IDENTITY = 1 << 0,
144 IS_CONNECTION_BASED = 1 << 1, 146 IS_CONNECTION_BASED = 1 << 1,
145 }; 147 };
146 148
147 // Initializes the handler using a challenge issued by a server. 149 // Initializes the handler using a challenge issued by a server.
148 // |challenge| must be non-NULL and have already tokenized the 150 // |challenge| must be non-NULL and have already tokenized the
149 // authentication scheme, but none of the tokens occurring after the 151 // authentication scheme, but none of the tokens occurring after the
150 // authentication scheme. 152 // authentication scheme.
153 //
154 // If the request was sent over an encrypted connection, |ssl_info| is valid
155 // and describes the connection.
156 //
151 // Implementations are expected to initialize the following members: 157 // Implementations are expected to initialize the following members:
152 // scheme_, realm_, score_, properties_ 158 // scheme_, realm_, score_, properties_
153 virtual bool Init(HttpAuthChallengeTokenizer* challenge) = 0; 159 virtual bool Init(HttpAuthChallengeTokenizer* challenge,
160 const SSLInfo& ssl_info) = 0;
154 161
155 // |GenerateAuthTokenImpl()} is the auth-scheme specific implementation 162 // |GenerateAuthTokenImpl()} is the auth-scheme specific implementation
156 // of generating the next auth token. Callers should use |GenerateAuthToken()| 163 // of generating the next auth token. Callers should use |GenerateAuthToken()|
157 // which will in turn call |GenerateAuthTokenImpl()| 164 // which will in turn call |GenerateAuthTokenImpl()|
158 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, 165 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials,
159 const HttpRequestInfo* request, 166 const HttpRequestInfo* request,
160 const CompletionCallback& callback, 167 const CompletionCallback& callback,
161 std::string* auth_token) = 0; 168 std::string* auth_token) = 0;
162 169
163 // The auth-scheme as an enumerated value. 170 // The auth-scheme as an enumerated value.
(...skipping 24 matching lines...) Expand all
188 private: 195 private:
189 void OnGenerateAuthTokenComplete(int rv); 196 void OnGenerateAuthTokenComplete(int rv);
190 void FinishGenerateAuthToken(); 197 void FinishGenerateAuthToken();
191 198
192 CompletionCallback callback_; 199 CompletionCallback callback_;
193 }; 200 };
194 201
195 } // namespace net 202 } // namespace net
196 203
197 #endif // NET_HTTP_HTTP_AUTH_HANDLER_H_ 204 #endif // NET_HTTP_HTTP_AUTH_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698