OLD | NEW |
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_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_H_ |
6 #define NET_HTTP_HTTP_AUTH_H_ | 6 #define NET_HTTP_HTTP_AUTH_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "net/base/auth.h" | 12 #include "net/base/auth.h" |
13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
14 #include "net/http/http_util.h" | 14 #include "net/http/http_util.h" |
15 | 15 |
16 template <class T> class scoped_refptr; | 16 template <class T> |
| 17 class scoped_refptr; |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
20 class BoundNetLog; | 21 class BoundNetLog; |
21 class HttpAuthHandler; | 22 class HttpAuthHandler; |
22 class HttpAuthHandlerFactory; | 23 class HttpAuthHandlerFactory; |
23 class HttpResponseHeaders; | 24 class HttpResponseHeaders; |
24 | 25 |
25 // Utility class for http authentication. | 26 // Utility class for http authentication. |
26 class NET_EXPORT_PRIVATE HttpAuth { | 27 class NET_EXPORT_PRIVATE HttpAuth { |
27 public: | 28 public: |
28 // Http authentication can be done the the proxy server, origin server, | 29 // Http authentication can be done the the proxy server, origin server, |
29 // or both. This enum tracks who the target is. | 30 // or both. This enum tracks who the target is. |
30 enum Target { | 31 enum Target { |
31 AUTH_NONE = -1, | 32 AUTH_NONE = -1, |
32 // We depend on the valid targets (!= AUTH_NONE) being usable as indexes | 33 // We depend on the valid targets (!= AUTH_NONE) being usable as indexes |
33 // in an array, so start from 0. | 34 // in an array, so start from 0. |
34 AUTH_PROXY = 0, | 35 AUTH_PROXY = 0, |
35 AUTH_SERVER = 1, | 36 AUTH_SERVER = 1, |
36 AUTH_NUM_TARGETS = 2, | 37 AUTH_NUM_TARGETS = 2, |
37 }; | 38 }; |
38 | 39 |
39 // What the HTTP WWW-Authenticate/Proxy-Authenticate headers indicate about | 40 // What the HTTP WWW-Authenticate/Proxy-Authenticate headers indicate about |
40 // the previous authorization attempt. | 41 // the previous authorization attempt. |
41 enum AuthorizationResult { | 42 enum AuthorizationResult { |
42 AUTHORIZATION_RESULT_ACCEPT, // The authorization attempt was accepted, | 43 AUTHORIZATION_RESULT_ACCEPT, // The authorization attempt was accepted, |
43 // although there still may be additional | 44 // although there still may be additional |
44 // rounds of challenges. | 45 // rounds of challenges. |
45 | |
46 AUTHORIZATION_RESULT_REJECT, // The authorization attempt was rejected. | 46 AUTHORIZATION_RESULT_REJECT, // The authorization attempt was rejected. |
47 | |
48 AUTHORIZATION_RESULT_STALE, // (Digest) The nonce used in the | 47 AUTHORIZATION_RESULT_STALE, // (Digest) The nonce used in the |
49 // authorization attempt is stale, but | 48 // authorization attempt is stale, but |
50 // otherwise the attempt was valid. | 49 // otherwise the attempt was valid. |
51 | |
52 AUTHORIZATION_RESULT_INVALID, // The authentication challenge headers are | 50 AUTHORIZATION_RESULT_INVALID, // The authentication challenge headers are |
53 // poorly formed (the authorization attempt | 51 // poorly formed (the authorization attempt |
54 // itself may have been fine). | 52 // itself may have been fine). |
55 | |
56 AUTHORIZATION_RESULT_DIFFERENT_REALM, // The authorization | 53 AUTHORIZATION_RESULT_DIFFERENT_REALM, // The authorization |
57 // attempt was rejected, | 54 // attempt was rejected, |
58 // but the realm associated | 55 // but the realm associated |
59 // with the new challenge | 56 // with the new challenge |
60 // is different from the | 57 // is different from the |
61 // previous attempt. | 58 // previous attempt. |
62 }; | 59 }; |
63 | 60 |
64 // Describes where the identity used for authentication came from. | 61 // Describes where the identity used for authentication came from. |
65 enum IdentitySource { | 62 enum IdentitySource { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 HttpAuthHandler* handler, | 162 HttpAuthHandler* handler, |
166 const HttpResponseHeaders* headers, | 163 const HttpResponseHeaders* headers, |
167 Target target, | 164 Target target, |
168 const std::set<Scheme>& disabled_schemes, | 165 const std::set<Scheme>& disabled_schemes, |
169 std::string* challenge_used); | 166 std::string* challenge_used); |
170 }; | 167 }; |
171 | 168 |
172 } // namespace net | 169 } // namespace net |
173 | 170 |
174 #endif // NET_HTTP_HTTP_AUTH_H_ | 171 #endif // NET_HTTP_HTTP_AUTH_H_ |
OLD | NEW |