forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that SAML IdPs use https on Chrome OS
This CL sets a CSP for the GAIA auth extension that ensures the entire login flow, including redirects to SAML IdPs, uses https. The FakeGaia and FakeSamlIdp classes used in SAML tests use the embedded test server, which speaks http only. The CL therefore adds a test server written in Python that speaks https and acts as a wrapper by forwarding calls to the embedded test server over http. TBR=asargent@chromium.org (for gaia_auth_extension_loader.cc) BUG=337437 TEST=Full browser test coverage Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=250114 Review URL: https://codereview.chromium.org/150483002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250230 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
bartfab@chromium.org
committed
Feb 10, 2014
1 parent
25e3234
commit f1b0f81
Showing
13 changed files
with
403 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/chromeos/login/test/https_forwarder.h" | ||
|
||
#include "base/base_paths.h" | ||
#include "base/files/file_path.h" | ||
#include "base/path_service.h" | ||
#include "base/values.h" | ||
#include "net/test/python_utils.h" | ||
|
||
namespace chromeos { | ||
|
||
HTTPSForwarder::HTTPSForwarder(const GURL& forward_target) | ||
: net::LocalTestServer(net::LocalTestServer::TYPE_HTTPS, | ||
net::LocalTestServer::kLocalhost, | ||
base::FilePath()), | ||
forward_target_(forward_target) { | ||
} | ||
|
||
HTTPSForwarder::~HTTPSForwarder() { | ||
} | ||
|
||
bool HTTPSForwarder::SetPythonPath() const { | ||
if (!net::LocalTestServer::SetPythonPath()) | ||
return false; | ||
|
||
base::FilePath net_testserver_path; | ||
if (!LocalTestServer::GetTestServerPath(&net_testserver_path)) | ||
return false; | ||
AppendToPythonPath(net_testserver_path.DirName()); | ||
|
||
return true; | ||
} | ||
|
||
bool HTTPSForwarder::GetTestServerPath(base::FilePath* testserver_path) const { | ||
base::FilePath source_root_dir; | ||
if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_root_dir)) | ||
return false; | ||
|
||
*testserver_path = source_root_dir.Append("chrome") | ||
.Append("browser") | ||
.Append("chromeos") | ||
.Append("login") | ||
.Append("test") | ||
.Append("https_forwarder.py"); | ||
return true; | ||
} | ||
|
||
bool HTTPSForwarder::GenerateAdditionalArguments( | ||
base::DictionaryValue* arguments) const { | ||
base::FilePath source_root_dir; | ||
if (!net::LocalTestServer::GenerateAdditionalArguments(arguments) || | ||
!PathService::Get(base::DIR_SOURCE_ROOT, &source_root_dir)) | ||
return false; | ||
|
||
arguments->SetString("forward-target", forward_target_.spec()); | ||
return true; | ||
} | ||
|
||
} // namespace chromeos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ | ||
#define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ | ||
|
||
#include "base/basictypes.h" | ||
#include "base/compiler_specific.h" | ||
#include "net/test/spawned_test_server/local_test_server.h" | ||
#include "url/gurl.h" | ||
|
||
namespace chromeos { | ||
|
||
// An https test server that forwards all requests to another server. This | ||
// allows a server that supports http only to be accessed over https. | ||
class HTTPSForwarder : public net::LocalTestServer { | ||
public: | ||
explicit HTTPSForwarder(const GURL& forward_target); | ||
virtual ~HTTPSForwarder(); | ||
|
||
// net::LocalTestServer: | ||
virtual bool SetPythonPath() const OVERRIDE; | ||
virtual bool GetTestServerPath( | ||
base::FilePath* testserver_path) const OVERRIDE; | ||
virtual bool GenerateAdditionalArguments( | ||
base::DictionaryValue* arguments) const OVERRIDE; | ||
|
||
private: | ||
GURL forward_target_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(HTTPSForwarder); | ||
}; | ||
|
||
} // namespace chromeos | ||
|
||
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ |
Oops, something went wrong.