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_FACTORY_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
6 #define NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 6 #define NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // |challenge| and calls |CreateAuthHandler|. See |CreateAuthHandler| for | 99 // |challenge| and calls |CreateAuthHandler|. See |CreateAuthHandler| for |
100 // more details on return values. | 100 // more details on return values. |
101 int CreatePreemptiveAuthHandlerFromString( | 101 int CreatePreemptiveAuthHandlerFromString( |
102 const std::string& challenge, | 102 const std::string& challenge, |
103 HttpAuth::Target target, | 103 HttpAuth::Target target, |
104 const GURL& origin, | 104 const GURL& origin, |
105 int digest_nonce_count, | 105 int digest_nonce_count, |
106 const BoundNetLog& net_log, | 106 const BoundNetLog& net_log, |
107 scoped_ptr<HttpAuthHandler>* handler); | 107 scoped_ptr<HttpAuthHandler>* handler); |
108 | 108 |
| 109 // For appropriate factories |SetNegotiateDisableCnameLookup()| sets whether |
| 110 // the auth handlers generated by this factory should skip looking up the |
| 111 // canonical DNS name of the the host that they are authenticating to when |
| 112 // generating the SPN. The default value is false. |
| 113 virtual void SetNegotiateDisableCnameLookup(bool disable_cname_lookup) {} |
| 114 |
| 115 // Sets the android account type to use, if relevant for this authenticator |
| 116 virtual void SetAndroidAuthNegotiateAccountType( |
| 117 const std::string& account_type) {} |
| 118 |
| 119 // For appropriate factories |SetNegotiateEnablePort()| get/set whether the |
| 120 // auth handlers |
| 121 // generated by this factory should include the port number of the server |
| 122 // they are authenticating to when constructing a Kerberos SPN. The default |
| 123 // value is false. |
| 124 virtual void SetNegotiateEnablePort(bool use_port) {} |
| 125 |
109 // Creates a standard HttpAuthHandlerRegistryFactory. The caller is | 126 // Creates a standard HttpAuthHandlerRegistryFactory. The caller is |
110 // responsible for deleting the factory. | 127 // responsible for deleting the factory. |
111 // The default factory supports Basic, Digest, NTLM, and Negotiate schemes. | 128 // The default factory supports Basic, Digest, NTLM, and Negotiate schemes. |
112 // | 129 // |
113 // |resolver| is used by the Negotiate authentication handler to perform | 130 // |resolver| is used by the Negotiate authentication handler to perform |
114 // CNAME lookups to generate a Kerberos SPN for the server. It must be | 131 // CNAME lookups to generate a Kerberos SPN for the server. It must be |
115 // non-NULL. |resolver| must remain valid for the lifetime of the | 132 // non-NULL. |resolver| must remain valid for the lifetime of the |
116 // HttpAuthHandlerRegistryFactory and any HttpAuthHandlers created by said | 133 // HttpAuthHandlerRegistryFactory and any HttpAuthHandlers created by said |
117 // factory. | 134 // factory. |
118 static scoped_ptr<HttpAuthHandlerRegistryFactory> CreateDefault( | 135 static scoped_ptr<HttpAuthHandlerRegistryFactory> CreateDefault( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // |auth_android_negotiate_account_type| is an Android account type, used to | 193 // |auth_android_negotiate_account_type| is an Android account type, used to |
177 // find the appropriate authenticator service on Android. It is ignored on | 194 // find the appropriate authenticator service on Android. It is ignored on |
178 // non-Android platforms. | 195 // non-Android platforms. |
179 // | 196 // |
180 // |negotiate_disable_cname_lookup| and |negotiate_enable_port| both control | 197 // |negotiate_disable_cname_lookup| and |negotiate_enable_port| both control |
181 // how Negotiate does SPN generation, by default these should be false. | 198 // how Negotiate does SPN generation, by default these should be false. |
182 static HttpAuthHandlerRegistryFactory* Create( | 199 static HttpAuthHandlerRegistryFactory* Create( |
183 const std::vector<std::string>& supported_schemes, | 200 const std::vector<std::string>& supported_schemes, |
184 URLSecurityManager* security_manager, | 201 URLSecurityManager* security_manager, |
185 HostResolver* host_resolver, | 202 HostResolver* host_resolver, |
186 const std::string& gssapi_library_name, | 203 const std::string& gssapi_library_name); |
187 const std::string& auth_android_negotiate_account_type, | 204 |
188 bool negotiate_disable_cname_lookup, | 205 void SetAndroidAuthNegotiateAccountType( |
189 bool negotiate_enable_port); | 206 const std::string& account_type) override; |
| 207 void SetNegotiateDisableCnameLookup( |
| 208 bool negotiate_disable_cname_lookup) override; |
| 209 void SetNegotiateEnablePort(bool negotiate_enable_port) override; |
190 | 210 |
191 // Creates an auth handler by dispatching out to the registered factories | 211 // Creates an auth handler by dispatching out to the registered factories |
192 // based on the first token in |challenge|. | 212 // based on the first token in |challenge|. |
193 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, | 213 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, |
194 HttpAuth::Target target, | 214 HttpAuth::Target target, |
195 const GURL& origin, | 215 const GURL& origin, |
196 CreateReason reason, | 216 CreateReason reason, |
197 int digest_nonce_count, | 217 int digest_nonce_count, |
198 const BoundNetLog& net_log, | 218 const BoundNetLog& net_log, |
199 scoped_ptr<HttpAuthHandler>* handler) override; | 219 scoped_ptr<HttpAuthHandler>* handler) override; |
200 | 220 |
201 private: | 221 private: |
202 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; | 222 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; |
203 | 223 |
204 FactoryMap factory_map_; | 224 FactoryMap factory_map_; |
205 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); | 225 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); |
206 }; | 226 }; |
207 | 227 |
208 } // namespace net | 228 } // namespace net |
209 | 229 |
210 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 230 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
OLD | NEW |