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

Side by Side Diff: chrome/browser/ui/login/login_prompt.cc

Issue 6804032: Add TLS-SRP (RFC 5054) support Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: remove "httpsv" scheme, minor NSS/OpenSSL changes Created 9 years, 8 months 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/ui/login/login_prompt.h" 5 #include "chrome/browser/ui/login/login_prompt.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 handled_auth_ = true; 343 handled_auth_ = true;
344 return was_handled; 344 return was_handled;
345 } 345 }
346 346
347 // Calls SetAuth from the IO loop. 347 // Calls SetAuth from the IO loop.
348 void LoginHandler::SetAuthDeferred(const std::wstring& username, 348 void LoginHandler::SetAuthDeferred(const std::wstring& username,
349 const std::wstring& password) { 349 const std::wstring& password) {
350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
351 351
352 if (request_) { 352 if (request_) {
353 request_->SetAuth(WideToUTF16Hack(username), WideToUTF16Hack(password)); 353 if (auth_info_->over_protocol == net::AUTH_OVER_TLS) {
354 DCHECK_EQ(ASCIIToWide(net::kTLSSRPScheme), auth_info_->scheme);
355 request_->SetTLSLogin(WideToUTF16Hack(username),
356 WideToUTF16Hack(password));
357 request_->ContinueWithTLSLogin();
358 } else {
359 request_->SetAuth(WideToUTF16Hack(username), WideToUTF16Hack(password));
360 }
354 ResetLoginHandlerForRequest(request_); 361 ResetLoginHandlerForRequest(request_);
355 } 362 }
356 } 363 }
357 364
358 // Calls CancelAuth from the IO loop. 365 // Calls CancelAuth from the IO loop.
359 void LoginHandler::CancelAuthDeferred() { 366 void LoginHandler::CancelAuthDeferred() {
360 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
361 368
362 if (request_) { 369 if (request_) {
363 request_->CancelAuth(); 370 if (auth_info_->over_protocol == net::AUTH_OVER_TLS) {
364 // Verify that CancelAuth doesn't destroy the request via our delegate. 371 DCHECK_EQ(ASCIIToWide(net::kTLSSRPScheme), auth_info_->scheme);
372 request_->CancelTLSLogin();
373 } else {
374 request_->CancelAuth();
375 }
376 // Verify that CancelAuth/CancelTLSLogin doesn't destroy the request via
377 // our delegate.
365 DCHECK(request_ != NULL); 378 DCHECK(request_ != NULL);
366 ResetLoginHandlerForRequest(request_); 379 ResetLoginHandlerForRequest(request_);
367 } 380 }
368 } 381 }
369 382
370 // Closes the view_contents from the UI loop. 383 // Closes the view_contents from the UI loop.
371 void LoginHandler::CloseContentsDeferred() { 384 void LoginHandler::CloseContentsDeferred() {
372 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 385 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
373 386
374 // The hosting ConstrainedWindow may have been freed. 387 // The hosting ConstrainedWindow may have been freed.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 private: 441 private:
429 // Helper to create a PasswordForm and stuff it into a vector as input 442 // Helper to create a PasswordForm and stuff it into a vector as input
430 // for PasswordManager::PasswordFormsFound, the hook into PasswordManager. 443 // for PasswordManager::PasswordFormsFound, the hook into PasswordManager.
431 void MakeInputForPasswordManager( 444 void MakeInputForPasswordManager(
432 std::vector<PasswordForm>* password_manager_input) { 445 std::vector<PasswordForm>* password_manager_input) {
433 PasswordForm dialog_form; 446 PasswordForm dialog_form;
434 if (LowerCaseEqualsASCII(auth_info_->scheme, "basic")) { 447 if (LowerCaseEqualsASCII(auth_info_->scheme, "basic")) {
435 dialog_form.scheme = PasswordForm::SCHEME_BASIC; 448 dialog_form.scheme = PasswordForm::SCHEME_BASIC;
436 } else if (LowerCaseEqualsASCII(auth_info_->scheme, "digest")) { 449 } else if (LowerCaseEqualsASCII(auth_info_->scheme, "digest")) {
437 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; 450 dialog_form.scheme = PasswordForm::SCHEME_DIGEST;
451 } else if (LowerCaseEqualsASCII(auth_info_->scheme, net::kTLSSRPScheme)) {
452 dialog_form.scheme = PasswordForm::SCHEME_TLS_SRP;
438 } else { 453 } else {
439 dialog_form.scheme = PasswordForm::SCHEME_OTHER; 454 dialog_form.scheme = PasswordForm::SCHEME_OTHER;
440 } 455 }
441 std::string host_and_port(WideToASCII(auth_info_->host_and_port)); 456 std::string host_and_port(WideToASCII(auth_info_->host_and_port));
442 if (auth_info_->is_proxy) { 457 if (auth_info_->is_proxy) {
443 std::string origin = host_and_port; 458 std::string origin = host_and_port;
444 // We don't expect this to already start with http:// or https://. 459 // We don't expect this to already start with http:// or https://.
445 DCHECK(origin.find("http://") != 0 && origin.find("https://") != 0); 460 DCHECK(origin.find("http://") != 0 && origin.find("https://") != 0);
446 origin = std::string("http://") + origin; 461 origin = std::string("http://") + origin;
447 dialog_form.origin = GURL(origin); 462 dialog_form.origin = GURL(origin);
448 } else if (net::GetHostAndPort(request_url_) != host_and_port) { 463 } else if (net::GetHostAndPort(request_url_) != host_and_port) {
464 LOG(INFO) << net::GetHostAndPort(request_url_) << " vs " << host_and_port;
449 dialog_form.origin = GURL(); 465 dialog_form.origin = GURL();
450 NOTREACHED(); // crbug.com/32718 466 NOTREACHED(); // crbug.com/32718
451 } else { 467 } else {
452 dialog_form.origin = GURL(request_url_.scheme() + "://" + host_and_port); 468 dialog_form.origin = GURL(request_url_.scheme() + "://" + host_and_port);
453 } 469 }
454 dialog_form.signon_realm = GetSignonRealm(dialog_form.origin, *auth_info_); 470 dialog_form.signon_realm = GetSignonRealm(dialog_form.origin, *auth_info_);
455 password_manager_input->push_back(dialog_form); 471 password_manager_input->push_back(dialog_form);
456 // Set the password form for the handler (by copy). 472 // Set the password form for the handler (by copy).
457 handler_->SetPasswordForm(dialog_form); 473 handler_->SetPasswordForm(dialog_form);
458 } 474 }
(...skipping 15 matching lines...) Expand all
474 // Public API 490 // Public API
475 491
476 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, 492 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info,
477 net::URLRequest* request) { 493 net::URLRequest* request) {
478 LoginHandler* handler = LoginHandler::Create(auth_info, request); 494 LoginHandler* handler = LoginHandler::Create(auth_info, request);
479 BrowserThread::PostTask( 495 BrowserThread::PostTask(
480 BrowserThread::UI, FROM_HERE, new LoginDialogTask( 496 BrowserThread::UI, FROM_HERE, new LoginDialogTask(
481 request->url(), auth_info, handler)); 497 request->url(), auth_info, handler));
482 return handler; 498 return handler;
483 } 499 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.cc ('k') | chrome/browser/ui/toolbar/toolbar_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698