| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 13 #include "net/http/http_auth.h" | 14 #include "net/http/http_auth.h" |
| 14 #include "net/http/url_security_manager.h" | 15 #include "net/http/url_security_manager.h" |
| 15 | 16 |
| 16 class GURL; | 17 class GURL; |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 | 20 |
| 20 class BoundNetLog; | 21 class BoundNetLog; |
| 22 class HostResolver; |
| 21 class HttpAuthHandler; | 23 class HttpAuthHandler; |
| 22 class HttpAuthHandlerRegistryFactory; | 24 class HttpAuthHandlerRegistryFactory; |
| 23 | 25 |
| 24 // An HttpAuthHandlerFactory is used to create HttpAuthHandler objects. | 26 // An HttpAuthHandlerFactory is used to create HttpAuthHandler objects. |
| 25 class HttpAuthHandlerFactory { | 27 class HttpAuthHandlerFactory { |
| 26 public: | 28 public: |
| 27 HttpAuthHandlerFactory() : url_security_manager_(NULL) {} | 29 HttpAuthHandlerFactory() : url_security_manager_(NULL) {} |
| 28 virtual ~HttpAuthHandlerFactory() {} | 30 virtual ~HttpAuthHandlerFactory() {} |
| 29 | 31 |
| 30 // Sets an URL security manager. HttpAuthHandlerFactory doesn't own the URL | 32 // Sets an URL security manager. HttpAuthHandlerFactory doesn't own the URL |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Creates an auth handler by dispatching out to the registered factories | 147 // Creates an auth handler by dispatching out to the registered factories |
| 146 // based on the first token in |challenge|. | 148 // based on the first token in |challenge|. |
| 147 virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge, | 149 virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge, |
| 148 HttpAuth::Target target, | 150 HttpAuth::Target target, |
| 149 const GURL& origin, | 151 const GURL& origin, |
| 150 CreateReason reason, | 152 CreateReason reason, |
| 151 int digest_nonce_count, | 153 int digest_nonce_count, |
| 152 const BoundNetLog& net_log, | 154 const BoundNetLog& net_log, |
| 153 scoped_ptr<HttpAuthHandler>* handler); | 155 scoped_ptr<HttpAuthHandler>* handler); |
| 154 | 156 |
| 157 // Creates an HttpAuthHandlerRegistryFactory. |
| 158 // |
| 159 // |supported_schemes| is a list of authentication schemes. Valid values |
| 160 // include "basic", "digest", "ntlm", and "negotiate", where case matters. |
| 161 // |
| 162 // |security_manager| is used by the NTLM and Negotiate authenticators |
| 163 // to determine which servers Integrated Authentication can be used with. If |
| 164 // NULL, Integrated Authentication will not be used with any server. |
| 165 // |
| 166 // |host_resolver| is used by the Negotiate authentication handler to perform |
| 167 // CNAME lookups to generate a Kerberos SPN for the server. If the "negotiate" |
| 168 // scheme is used and |negotiate_disable_cname_lookup| is false, |
| 169 // |host_resolver| must not be NULL. |
| 170 // |
| 171 // |negotiate_disable_cname_lookup| and |negotiate_enable_port| both control |
| 172 // how Negotiate does SPN generation, by default these should be false. |
| 173 static HttpAuthHandlerRegistryFactory* Create( |
| 174 const std::vector<std::string>& supported_schemes, |
| 175 URLSecurityManager* security_manager, |
| 176 HostResolver* host_resolver, |
| 177 bool negotiate_disable_cname_lookup, |
| 178 bool negotiate_enable_port); |
| 179 |
| 155 private: | 180 private: |
| 156 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; | 181 typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap; |
| 157 | 182 |
| 158 FactoryMap factory_map_; | 183 FactoryMap factory_map_; |
| 159 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); | 184 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); |
| 160 }; | 185 }; |
| 161 | 186 |
| 162 } // namespace net | 187 } // namespace net |
| 163 | 188 |
| 164 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 189 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
| OLD | NEW |