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

Side by Side Diff: google_apis/gaia/fake_gaia.h

Issue 1004753004: cros: Port SAML support to webview sign-in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle loadabort to fix test Created 5 years, 9 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 GOOGLE_APIS_GAIA_FAKE_GAIA_H_ 5 #ifndef GOOGLE_APIS_GAIA_FAKE_GAIA_H_
6 #define GOOGLE_APIS_GAIA_FAKE_GAIA_H_ 6 #define GOOGLE_APIS_GAIA_FAKE_GAIA_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // login-scoped access token for the token minting endpoint. Note that the 106 // login-scoped access token for the token minting endpoint. Note that the
107 // scope and audience requested by the client need to match the token_info. 107 // scope and audience requested by the client need to match the token_info.
108 void IssueOAuthToken(const std::string& auth_token, 108 void IssueOAuthToken(const std::string& auth_token,
109 const AccessTokenInfo& token_info); 109 const AccessTokenInfo& token_info);
110 110
111 // Associates an account id with a SAML IdP redirect endpoint. When a 111 // Associates an account id with a SAML IdP redirect endpoint. When a
112 // /ServiceLoginAuth request comes in for that user, it will be redirected 112 // /ServiceLoginAuth request comes in for that user, it will be redirected
113 // to the associated redirect endpoint. 113 // to the associated redirect endpoint.
114 void RegisterSamlUser(const std::string& account_id, const GURL& saml_idp); 114 void RegisterSamlUser(const std::string& account_id, const GURL& saml_idp);
115 115
116 void set_issue_oauth_code_cookie(bool value) {
117 issue_oauth_code_cookie_ = value;
118 }
119
116 // Extracts the parameter named |key| from |query| and places it in |value|. 120 // Extracts the parameter named |key| from |query| and places it in |value|.
117 // Returns false if no parameter is found. 121 // Returns false if no parameter is found.
118 static bool GetQueryParameter(const std::string& query, 122 static bool GetQueryParameter(const std::string& query,
119 const std::string& key, 123 const std::string& key,
120 std::string* value); 124 std::string* value);
121 protected: 125 protected:
122 // HTTP handler for /MergeSession. 126 // HTTP handler for /MergeSession.
123 virtual void HandleMergeSession( 127 virtual void HandleMergeSession(
124 const net::test_server::HttpRequest& request, 128 const net::test_server::HttpRequest& request,
125 net::test_server::BasicHttpResponse* http_response); 129 net::test_server::BasicHttpResponse* http_response);
126 130
127 private: 131 private:
128 typedef std::multimap<std::string, AccessTokenInfo> AccessTokenInfoMap; 132 typedef std::multimap<std::string, AccessTokenInfo> AccessTokenInfoMap;
129 typedef std::map<std::string, std::string> EmailToGaiaIdMap; 133 typedef std::map<std::string, std::string> EmailToGaiaIdMap;
130 typedef std::map<std::string, GURL> SamlAccountIdpMap; 134 typedef std::map<std::string, GURL> SamlAccountIdpMap;
131 135
132 std::string GetGaiaIdOfEmail(const std::string& email) const; 136 std::string GetGaiaIdOfEmail(const std::string& email) const;
133 137
134 void AddGoogleAccountsSigninHeader( 138 void AddGoogleAccountsSigninHeader(
135 net::test_server::BasicHttpResponse* http_response, 139 net::test_server::BasicHttpResponse* http_response,
136 const std::string& email) const; 140 const std::string& email) const;
137 141
142 void SetOAuthCodeCookie(
143 net::test_server::BasicHttpResponse* http_response) const;
144
138 // Formats a JSON response with the data in |response_dict|. 145 // Formats a JSON response with the data in |response_dict|.
139 void FormatJSONResponse(const base::DictionaryValue& response_dict, 146 void FormatJSONResponse(const base::DictionaryValue& response_dict,
140 net::test_server::BasicHttpResponse* http_response); 147 net::test_server::BasicHttpResponse* http_response);
141 148
142 typedef base::Callback<void( 149 typedef base::Callback<void(
143 const net::test_server::HttpRequest& request, 150 const net::test_server::HttpRequest& request,
144 net::test_server::BasicHttpResponse* http_response)> 151 net::test_server::BasicHttpResponse* http_response)>
145 HttpRequestHandlerCallback; 152 HttpRequestHandlerCallback;
146 typedef std::map<std::string, HttpRequestHandlerCallback> RequestHandlerMap; 153 typedef std::map<std::string, HttpRequestHandlerCallback> RequestHandlerMap;
147 154
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Returns the access token identified by |access_token| or NULL if not found. 192 // Returns the access token identified by |access_token| or NULL if not found.
186 const AccessTokenInfo* GetAccessTokenInfo( 193 const AccessTokenInfo* GetAccessTokenInfo(
187 const std::string& access_token) const; 194 const std::string& access_token) const;
188 195
189 MergeSessionParams merge_session_params_; 196 MergeSessionParams merge_session_params_;
190 EmailToGaiaIdMap email_to_gaia_id_map_; 197 EmailToGaiaIdMap email_to_gaia_id_map_;
191 AccessTokenInfoMap access_token_info_map_; 198 AccessTokenInfoMap access_token_info_map_;
192 RequestHandlerMap request_handlers_; 199 RequestHandlerMap request_handlers_;
193 std::string service_login_response_; 200 std::string service_login_response_;
194 SamlAccountIdpMap saml_account_idp_map_; 201 SamlAccountIdpMap saml_account_idp_map_;
202 bool issue_oauth_code_cookie_;
195 203
196 DISALLOW_COPY_AND_ASSIGN(FakeGaia); 204 DISALLOW_COPY_AND_ASSIGN(FakeGaia);
197 }; 205 };
198 206
199 #endif // GOOGLE_APIS_GAIA_FAKE_GAIA_H_ 207 #endif // GOOGLE_APIS_GAIA_FAKE_GAIA_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/gaia_auth_host/webview_saml_injected.js ('k') | google_apis/gaia/fake_gaia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698