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_HANDLER_NEGOTIATE_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
13 #include "net/http/http_auth_handler.h" | 13 #include "net/http/http_auth_handler.h" |
14 #include "net/http/http_auth_handler_factory.h" | 14 #include "net/http/http_auth_handler_factory.h" |
15 | 15 |
16 #if defined(OS_WIN) | 16 #if defined(OS_ANDROID) |
17 #include "net/android/http_auth_negotiate_android.h" | |
18 #elif defined(OS_WIN) | |
17 #include "net/http/http_auth_sspi_win.h" | 19 #include "net/http/http_auth_sspi_win.h" |
18 #elif defined(OS_POSIX) | 20 #elif defined(OS_POSIX) |
19 #include "net/http/http_auth_gssapi_posix.h" | 21 #include "net/http/http_auth_gssapi_posix.h" |
20 #endif | 22 #endif |
21 | 23 |
22 namespace net { | 24 namespace net { |
23 | 25 |
24 class HostResolver; | 26 class HostResolver; |
25 class SingleRequestHostResolver; | 27 class SingleRequestHostResolver; |
26 class URLSecurityManager; | 28 class URLSecurityManager; |
27 | 29 |
28 // Handler for WWW-Authenticate: Negotiate protocol. | 30 // Handler for WWW-Authenticate: Negotiate protocol. |
29 // | 31 // |
30 // See http://tools.ietf.org/html/rfc4178 and http://tools.ietf.org/html/rfc4559 | 32 // See http://tools.ietf.org/html/rfc4178 and http://tools.ietf.org/html/rfc4559 |
31 // for more information about the protocol. | 33 // for more information about the protocol. |
32 | 34 |
33 class NET_EXPORT_PRIVATE HttpAuthHandlerNegotiate : public HttpAuthHandler { | 35 class NET_EXPORT_PRIVATE HttpAuthHandlerNegotiate : public HttpAuthHandler { |
34 public: | 36 public: |
35 #if defined(OS_WIN) | 37 #if defined(OS_ANDROID) |
38 typedef net::android::HttpAuthNegotiateAndroid AuthSystem; | |
39 typedef const std::string AuthLibrary; | |
40 #elif defined(OS_WIN) | |
36 typedef SSPILibrary AuthLibrary; | 41 typedef SSPILibrary AuthLibrary; |
37 typedef HttpAuthSSPI AuthSystem; | 42 typedef HttpAuthSSPI AuthSystem; |
38 #elif defined(OS_POSIX) | 43 #elif defined(OS_POSIX) |
39 typedef GSSAPILibrary AuthLibrary; | 44 typedef GSSAPILibrary AuthLibrary; |
40 typedef HttpAuthGSSAPI AuthSystem; | 45 typedef HttpAuthGSSAPI AuthSystem; |
41 #endif | 46 #endif |
42 | 47 |
43 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { | 48 class NET_EXPORT_PRIVATE Factory : public HttpAuthHandlerFactory { |
44 public: | 49 public: |
45 Factory(); | 50 Factory(); |
(...skipping 12 matching lines...) Expand all Loading... | |
58 // generated by this factory should include the port number of the server | 63 // generated by this factory should include the port number of the server |
59 // they are authenticating to when constructing a Kerberos SPN. The default | 64 // they are authenticating to when constructing a Kerberos SPN. The default |
60 // value is false. | 65 // value is false. |
61 bool use_port() const { return use_port_; } | 66 bool use_port() const { return use_port_; } |
62 void set_use_port(bool use_port) { use_port_ = use_port; } | 67 void set_use_port(bool use_port) { use_port_ = use_port; } |
63 | 68 |
64 void set_host_resolver(HostResolver* host_resolver); | 69 void set_host_resolver(HostResolver* host_resolver); |
65 | 70 |
66 // Sets the system library to use, thereby assuming ownership of | 71 // Sets the system library to use, thereby assuming ownership of |
67 // |auth_library|. | 72 // |auth_library|. |
68 void set_library(AuthLibrary* auth_library) { | 73 void set_library(AuthLibrary* auth_provider) { |
69 auth_library_.reset(auth_library); | 74 auth_library_.reset(auth_provider); |
70 } | 75 } |
71 | 76 |
72 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, | 77 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, |
73 HttpAuth::Target target, | 78 HttpAuth::Target target, |
74 const GURL& origin, | 79 const GURL& origin, |
75 CreateReason reason, | 80 CreateReason reason, |
76 int digest_nonce_count, | 81 int digest_nonce_count, |
77 const BoundNetLog& net_log, | 82 const BoundNetLog& net_log, |
78 scoped_ptr<HttpAuthHandler>* handler) override; | 83 scoped_ptr<HttpAuthHandler>* handler) override; |
79 | 84 |
80 private: | 85 private: |
81 bool disable_cname_lookup_; | 86 bool disable_cname_lookup_; |
82 bool use_port_; | 87 bool use_port_; |
83 HostResolver* resolver_; | 88 HostResolver* resolver_; |
84 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
85 ULONG max_token_length_; | 90 ULONG max_token_length_; |
86 bool first_creation_; | 91 bool first_creation_; |
87 #endif | 92 #endif |
88 bool is_unsupported_; | 93 bool is_unsupported_; |
89 scoped_ptr<AuthLibrary> auth_library_; | 94 scoped_ptr<AuthLibrary> auth_library_; |
90 }; | 95 }; |
91 | 96 |
92 HttpAuthHandlerNegotiate(AuthLibrary* sspi_library, | 97 HttpAuthHandlerNegotiate(AuthLibrary* sspi_library, |
cbentzel
2015/07/08 18:27:11
Nit: could you rename sspi_library to auth_library
aberent
2015/07/09 13:38:45
Done.
| |
93 #if defined(OS_WIN) | 98 #if defined(OS_WIN) |
94 ULONG max_token_length, | 99 ULONG max_token_length, |
95 #endif | 100 #endif |
96 URLSecurityManager* url_security_manager, | 101 URLSecurityManager* url_security_manager, |
97 HostResolver* host_resolver, | 102 HostResolver* host_resolver, |
98 bool disable_cname_lookup, | 103 bool disable_cname_lookup, |
99 bool use_port); | 104 bool use_port); |
100 | 105 |
101 ~HttpAuthHandlerNegotiate() override; | 106 ~HttpAuthHandlerNegotiate() override; |
102 | 107 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 std::string* auth_token_; | 163 std::string* auth_token_; |
159 | 164 |
160 State next_state_; | 165 State next_state_; |
161 | 166 |
162 const URLSecurityManager* url_security_manager_; | 167 const URLSecurityManager* url_security_manager_; |
163 }; | 168 }; |
164 | 169 |
165 } // namespace net | 170 } // namespace net |
166 | 171 |
167 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ | 172 #endif // NET_HTTP_HTTP_AUTH_HANDLER_NEGOTIATE_H_ |
OLD | NEW |