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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // If |*challenge| is improperly formed, |*handler| is set to NULL and | 66 // If |*challenge| is improperly formed, |*handler| is set to NULL and |
67 // ERR_INVALID_RESPONSE is returned. | 67 // ERR_INVALID_RESPONSE is returned. |
68 // | 68 // |
69 // |create_reason| indicates why the handler is being created. This is used | 69 // |create_reason| indicates why the handler is being created. This is used |
70 // since NTLM and Negotiate schemes do not support preemptive creation. | 70 // since NTLM and Negotiate schemes do not support preemptive creation. |
71 // | 71 // |
72 // |digest_nonce_count| is specifically intended for the Digest authentication | 72 // |digest_nonce_count| is specifically intended for the Digest authentication |
73 // scheme, and indicates the number of handlers generated for a particular | 73 // scheme, and indicates the number of handlers generated for a particular |
74 // server nonce challenge. | 74 // server nonce challenge. |
75 // | 75 // |
| 76 // |ssl_info| is valid if the authentication session is being established over |
| 77 // a secure connection. |
| 78 // |
76 // For the NTLM and Negotiate handlers: | 79 // For the NTLM and Negotiate handlers: |
77 // If |origin| does not match the authentication method's filters for | 80 // If |origin| does not match the authentication method's filters for |
78 // the specified |target|, ERR_INVALID_AUTH_CREDENTIALS is returned. | 81 // the specified |target|, ERR_INVALID_AUTH_CREDENTIALS is returned. |
79 // NOTE: This will apply to ALL |origin| values if the filters are empty. | 82 // NOTE: This will apply to ALL |origin| values if the filters are empty. |
80 // | 83 // |
81 // |*challenge| should not be reused after a call to |CreateAuthHandler()|, | 84 // |*challenge| should not be reused after a call to |CreateAuthHandler()|, |
82 virtual int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, | 85 virtual int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, |
83 HttpAuth::Target target, | 86 HttpAuth::Target target, |
| 87 const SSLInfo& ssl_info, |
84 const GURL& origin, | 88 const GURL& origin, |
85 CreateReason create_reason, | 89 CreateReason create_reason, |
86 int digest_nonce_count, | 90 int digest_nonce_count, |
87 const BoundNetLog& net_log, | 91 const BoundNetLog& net_log, |
88 scoped_ptr<HttpAuthHandler>* handler) = 0; | 92 scoped_ptr<HttpAuthHandler>* handler) = 0; |
89 | 93 |
90 // Creates an HTTP authentication handler based on the authentication | 94 // Creates an HTTP authentication handler based on the authentication |
91 // challenge string |challenge|. | 95 // challenge string |challenge|. |
92 // This is a convenience function which creates a ChallengeTokenizer for | 96 // This is a convenience function which creates a ChallengeTokenizer for |
93 // |challenge| and calls |CreateAuthHandler|. See |CreateAuthHandler| for | 97 // |challenge| and calls |CreateAuthHandler|. See |CreateAuthHandler| for |
94 // more details on return values. | 98 // more details on return values. |
95 int CreateAuthHandlerFromString(const std::string& challenge, | 99 int CreateAuthHandlerFromString(const std::string& challenge, |
96 HttpAuth::Target target, | 100 HttpAuth::Target target, |
| 101 const SSLInfo& ssl_info, |
97 const GURL& origin, | 102 const GURL& origin, |
98 const BoundNetLog& net_log, | 103 const BoundNetLog& net_log, |
99 scoped_ptr<HttpAuthHandler>* handler); | 104 scoped_ptr<HttpAuthHandler>* handler); |
100 | 105 |
101 // Creates an HTTP authentication handler based on the authentication | 106 // Creates an HTTP authentication handler based on the authentication |
102 // challenge string |challenge|. | 107 // challenge string |challenge|. |
103 // This is a convenience function which creates a ChallengeTokenizer for | 108 // This is a convenience function which creates a ChallengeTokenizer for |
104 // |challenge| and calls |CreateAuthHandler|. See |CreateAuthHandler| for | 109 // |challenge| and calls |CreateAuthHandler|. See |CreateAuthHandler| for |
105 // more details on return values. | 110 // more details on return values. |
106 int CreatePreemptiveAuthHandlerFromString( | 111 int CreatePreemptiveAuthHandlerFromString( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // CNAME lookups to generate a Kerberos SPN for the server. If the "negotiate" | 175 // CNAME lookups to generate a Kerberos SPN for the server. If the "negotiate" |
171 // scheme is used and |negotiate_disable_cname_lookup| is false, | 176 // scheme is used and |negotiate_disable_cname_lookup| is false, |
172 // |host_resolver| must not be NULL. | 177 // |host_resolver| must not be NULL. |
173 static scoped_ptr<HttpAuthHandlerRegistryFactory> Create( | 178 static scoped_ptr<HttpAuthHandlerRegistryFactory> Create( |
174 const HttpAuthPreferences* prefs, | 179 const HttpAuthPreferences* prefs, |
175 HostResolver* host_resolver); | 180 HostResolver* host_resolver); |
176 // Creates an auth handler by dispatching out to the registered factories | 181 // Creates an auth handler by dispatching out to the registered factories |
177 // based on the first token in |challenge|. | 182 // based on the first token in |challenge|. |
178 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, | 183 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, |
179 HttpAuth::Target target, | 184 HttpAuth::Target target, |
| 185 const SSLInfo& ssl_info, |
180 const GURL& origin, | 186 const GURL& origin, |
181 CreateReason reason, | 187 CreateReason reason, |
182 int digest_nonce_count, | 188 int digest_nonce_count, |
183 const BoundNetLog& net_log, | 189 const BoundNetLog& net_log, |
184 scoped_ptr<HttpAuthHandler>* handler) override; | 190 scoped_ptr<HttpAuthHandler>* handler) override; |
185 | 191 |
186 private: | 192 private: |
187 using FactoryMap = std::map<std::string, scoped_ptr<HttpAuthHandlerFactory>>; | 193 using FactoryMap = std::map<std::string, scoped_ptr<HttpAuthHandlerFactory>>; |
188 | 194 |
189 FactoryMap factory_map_; | 195 FactoryMap factory_map_; |
190 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); | 196 DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory); |
191 }; | 197 }; |
192 | 198 |
193 } // namespace net | 199 } // namespace net |
194 | 200 |
195 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ | 201 #endif // NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_ |
OLD | NEW |