diff options
author | dzhioev <dzhioev@chromium.org> | 2015-10-09 01:09:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-09 08:09:39 +0000 |
commit | 12e14dbb1ead667d243bd746f1cb2460f8326d47 (patch) | |
tree | 84da1a4b118a90707fb299678c255e4c714debf6 /google_apis | |
parent | 2cd49bb3ebb9ce32d49aa2dd7a80ca0593855890 (diff) | |
download | chromium_src-12e14dbb1ead667d243bd746f1cb2460f8326d47.zip chromium_src-12e14dbb1ead667d243bd746f1cb2460f8326d47.tar.gz chromium_src-12e14dbb1ead667d243bd746f1cb2460f8326d47.tar.bz2 |
Do not rely on a continue URL when the new GAIA flow is used.
When I tried to disable the GAIA extension in Chrome OS, I noticed that this
makes several SAML tests to fail. That happens because:
a) FakeGAIA is configured to redirect to
chrome-extension://<gaia-extension-hash>/success.html on SAML authentication
success.
b) The logic that reacts on "success.html" redirect is still enabled in
authenticator.js.
As it doesn't matter for the new flow which continue URL is used (in fact we
don't even pass "continue" to GAIA anymore), I disabled this logic for the new
flow.
TBR=bartfab@chromium.org
BUG=470893
TEST=existing tests
Review URL: https://codereview.chromium.org/1361423005
Cr-Commit-Position: refs/heads/master@{#353248}
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/gaia/fake_gaia.cc | 20 | ||||
-rw-r--r-- | google_apis/gaia/fake_gaia.h | 3 |
2 files changed, 20 insertions, 3 deletions
diff --git a/google_apis/gaia/fake_gaia.cc b/google_apis/gaia/fake_gaia.cc index 699c2c6..60c048b 100644 --- a/google_apis/gaia/fake_gaia.cc +++ b/google_apis/gaia/fake_gaia.cc @@ -66,6 +66,8 @@ const char kAuthHeaderOAuth[] = "OAuth "; const char kListAccountsResponseFormat[] = "[\"gaia.l.a.r\",[[\"gaia.l.a\",1,\"\",\"%s\",\"\",1,1,0,0,1,\"12345\"]]]"; +const char kDummySAMLContinuePath[] = "DummySAMLContinue"; + typedef std::map<std::string, std::string> CookieMap; // Parses cookie name-value map our of |request|. @@ -263,6 +265,10 @@ void FakeGaia::Initialize() { // Handles /SSO GAIA call (not GAIA, made up for SAML tests). REGISTER_PATH_RESPONSE_HANDLER("/SSO", HandleSSO); + REGISTER_RESPONSE_HANDLER( + gaia_urls->gaia_url().Resolve(kDummySAMLContinuePath), + HandleDummySAMLContinue); + // Handles /oauth2/v4/token GAIA call. REGISTER_RESPONSE_HANDLER( gaia_urls->oauth2_token_url(), HandleAuthToken); @@ -580,9 +586,11 @@ void FakeGaia::HandleEmbeddedLookupAccountLookup( GURL url(saml_account_idp_map_[email]); url = net::AppendQueryParameter(url, "SAMLRequest", "fake_request"); - url = net::AppendQueryParameter( - url, "RelayState", - GaiaUrls::GetInstance()->signin_completed_continue_url().spec()); + url = net::AppendQueryParameter(url, "RelayState", + GaiaUrls::GetInstance() + ->gaia_url() + .Resolve(kDummySAMLContinuePath) + .spec()); std::string redirect_url = url.spec(); http_response->AddCustomHeader("Google-Accounts-SAML", "Start"); @@ -628,6 +636,12 @@ void FakeGaia::HandleSSO(const HttpRequest& request, SetOAuthCodeCookie(http_response); } +void FakeGaia::HandleDummySAMLContinue(const HttpRequest& request, + BasicHttpResponse* http_response) { + http_response->set_content(""); + http_response->set_code(net::HTTP_OK); +} + void FakeGaia::HandleAuthToken(const HttpRequest& request, BasicHttpResponse* http_response) { std::string grant_type; diff --git a/google_apis/gaia/fake_gaia.h b/google_apis/gaia/fake_gaia.h index f84e2e7..05c44d5 100644 --- a/google_apis/gaia/fake_gaia.h +++ b/google_apis/gaia/fake_gaia.h @@ -192,6 +192,9 @@ class FakeGaia { net::test_server::BasicHttpResponse* http_response); void HandleSSO(const net::test_server::HttpRequest& request, net::test_server::BasicHttpResponse* http_response); + void HandleDummySAMLContinue( + const net::test_server::HttpRequest& request, + net::test_server::BasicHttpResponse* http_response); void HandleAuthToken(const net::test_server::HttpRequest& request, net::test_server::BasicHttpResponse* http_response); void HandleTokenInfo(const net::test_server::HttpRequest& request, |