Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1175)

Side by Side Diff: net/http/http_auth_handler_negotiate.cc

Issue 4560001: Support specifying the GSSAPI library that will be used. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix another compile error on Windows Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "net/http/http_auth_handler_negotiate.h" 5 #include "net/http/http_auth_handler_negotiate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 callback->Run(rv); 267 callback->Run(rv);
268 } 268 }
269 269
270 HttpAuthHandlerNegotiate::Factory::Factory() 270 HttpAuthHandlerNegotiate::Factory::Factory()
271 : disable_cname_lookup_(false), 271 : disable_cname_lookup_(false),
272 use_port_(false), 272 use_port_(false),
273 #if defined(OS_WIN) 273 #if defined(OS_WIN)
274 max_token_length_(0), 274 max_token_length_(0),
275 first_creation_(true), 275 first_creation_(true),
276 is_unsupported_(false), 276 is_unsupported_(false),
277 auth_library_(SSPILibrary::GetDefault()) {
278 #elif defined(OS_POSIX)
279 auth_library_(GSSAPILibrary::GetDefault()) {
280 #endif 277 #endif
278 auth_library_(NULL) {
281 } 279 }
282 280
283 HttpAuthHandlerNegotiate::Factory::~Factory() { 281 HttpAuthHandlerNegotiate::Factory::~Factory() {
284 } 282 }
285 283
286 void HttpAuthHandlerNegotiate::Factory::set_host_resolver( 284 void HttpAuthHandlerNegotiate::Factory::set_host_resolver(
287 HostResolver* resolver) { 285 HostResolver* resolver) {
288 resolver_ = resolver; 286 resolver_ = resolver;
289 } 287 }
290 288
291 int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler( 289 int HttpAuthHandlerNegotiate::Factory::CreateAuthHandler(
292 HttpAuth::ChallengeTokenizer* challenge, 290 HttpAuth::ChallengeTokenizer* challenge,
293 HttpAuth::Target target, 291 HttpAuth::Target target,
294 const GURL& origin, 292 const GURL& origin,
295 CreateReason reason, 293 CreateReason reason,
296 int digest_nonce_count, 294 int digest_nonce_count,
297 const BoundNetLog& net_log, 295 const BoundNetLog& net_log,
298 scoped_ptr<HttpAuthHandler>* handler) { 296 scoped_ptr<HttpAuthHandler>* handler) {
299 #if defined(OS_WIN) 297 #if defined(OS_WIN)
300 if (is_unsupported_ || reason == CREATE_PREEMPTIVE) 298 if (is_unsupported_ || reason == CREATE_PREEMPTIVE)
301 return ERR_UNSUPPORTED_AUTH_SCHEME; 299 return ERR_UNSUPPORTED_AUTH_SCHEME;
302 if (max_token_length_ == 0) { 300 if (max_token_length_ == 0) {
303 int rv = DetermineMaxTokenLength(auth_library_, NEGOSSP_NAME, 301 int rv = DetermineMaxTokenLength(auth_library_.get(), NEGOSSP_NAME,
304 &max_token_length_); 302 &max_token_length_);
305 if (rv == ERR_UNSUPPORTED_AUTH_SCHEME) 303 if (rv == ERR_UNSUPPORTED_AUTH_SCHEME)
306 is_unsupported_ = true; 304 is_unsupported_ = true;
307 if (rv != OK) 305 if (rv != OK)
308 return rv; 306 return rv;
309 } 307 }
310 // TODO(cbentzel): Move towards model of parsing in the factory 308 // TODO(cbentzel): Move towards model of parsing in the factory
311 // method and only constructing when valid. 309 // method and only constructing when valid.
312 scoped_ptr<HttpAuthHandler> tmp_handler( 310 scoped_ptr<HttpAuthHandler> tmp_handler(
313 new HttpAuthHandlerNegotiate(auth_library_, max_token_length_, 311 new HttpAuthHandlerNegotiate(auth_library_.get(), max_token_length_,
314 url_security_manager(), resolver_, 312 url_security_manager(), resolver_,
315 disable_cname_lookup_, use_port_)); 313 disable_cname_lookup_, use_port_));
316 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) 314 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log))
317 return ERR_INVALID_RESPONSE; 315 return ERR_INVALID_RESPONSE;
318 handler->swap(tmp_handler); 316 handler->swap(tmp_handler);
319 return OK; 317 return OK;
320 #elif defined(OS_POSIX) 318 #elif defined(OS_POSIX)
321 // TODO(ahendrickson): Move towards model of parsing in the factory 319 // TODO(ahendrickson): Move towards model of parsing in the factory
322 // method and only constructing when valid. 320 // method and only constructing when valid.
323 scoped_ptr<HttpAuthHandler> tmp_handler( 321 scoped_ptr<HttpAuthHandler> tmp_handler(
324 new HttpAuthHandlerNegotiate(auth_library_, url_security_manager(), 322 new HttpAuthHandlerNegotiate(auth_library_.get(), url_security_manager(),
325 resolver_, disable_cname_lookup_, 323 resolver_, disable_cname_lookup_,
326 use_port_)); 324 use_port_));
327 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) 325 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log))
328 return ERR_INVALID_RESPONSE; 326 return ERR_INVALID_RESPONSE;
329 handler->swap(tmp_handler); 327 handler->swap(tmp_handler);
330 return OK; 328 return OK;
331 #endif 329 #endif
332 } 330 }
333 331
334 } // namespace net 332 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_negotiate.h ('k') | net/http/http_auth_handler_negotiate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698