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

Side by Side Diff: chrome/browser/sync/notifier/gaia_auth/gaiaauth.h

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // Gaia auth code for XMPP notifier support. This should be merged with
6 // the other gaia auth file when we have time.
7
8 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_GAIA_AUTH_GAIAAUTH_H_
9 #define CHROME_BROWSER_SYNC_NOTIFIER_GAIA_AUTH_GAIAAUTH_H_
10
11 #include <string>
12 #include <vector>
13
14 #include "chrome/browser/sync/notifier/gaia_auth/gaiahelper.h"
15 #include "talk/base/cryptstring.h"
16 #include "talk/base/messagequeue.h"
17 #include "talk/base/proxyinfo.h"
18 #include "talk/xmpp/prexmppauth.h"
19
20 namespace talk_base {
21 class FirewallManager;
22 class SignalThread;
23 }
24
25 namespace buzz {
26
27 ///////////////////////////////////////////////////////////////////////////////
28 // GaiaAuth
29 ///////////////////////////////////////////////////////////////////////////////
30
31 class GaiaAuth : public PreXmppAuth, public sigslot::has_slots<> {
32 public:
33 GaiaAuth(const std::string& user_agent, const std::string& signature);
34 virtual ~GaiaAuth();
35
36 void set_proxy(const talk_base::ProxyInfo& proxy) {
37 proxy_ = proxy;
38 }
39 void set_firewall(talk_base::FirewallManager* firewall) {
40 firewall_ = firewall;
41 }
42 void set_captcha_answer(const CaptchaAnswer& captcha_answer) {
43 captcha_answer_ = captcha_answer;
44 }
45
46 // From inside XMPP login, this is called
47 virtual void StartPreXmppAuth(const buzz::Jid& jid,
48 const talk_base::SocketAddress& server,
49 const talk_base::CryptString& pass,
50 const std::string& auth_cookie);
51
52 void StartTokenAuth(const buzz::Jid& jid,
53 const talk_base::CryptString& pass,
54 const std::string& service);
55
56 // This is used when calling GetAuth()
57 void StartAuth(const buzz::Jid& jid,
58 const talk_base::CryptString& pass,
59 const std::string& service);
60
61 // This is used when bootstrapping from a download page
62 void StartAuthFromSid(const buzz::Jid& jid,
63 const std::string& sid,
64 const std::string& service);
65
66 virtual bool IsAuthDone();
67 virtual bool IsAuthorized();
68 virtual bool HadError();
69 virtual int GetError();
70 virtual buzz::CaptchaChallenge GetCaptchaChallenge();
71 // Returns the auth token that can be sent in an url param to gaia in order
72 // to generate an auth cookie.
73 virtual std::string GetAuthCookie();
74
75 // Returns the auth cookie for gaia.
76 std::string GetAuth();
77 std::string GetSID();
78
79 // Sets / gets the token service to use.
80 std::string token_service() const { return token_service_; }
81 void set_token_service(const std::string& token_service) {
82 token_service_ = token_service;
83 }
84
85 virtual std::string ChooseBestSaslMechanism(
86 const std::vector<std::string>& mechanisms, bool encrypted);
87 virtual buzz::SaslMechanism* CreateSaslMechanism(
88 const std::string& mechanism);
89
90 std::string CreateAuthenticatedUrl(const std::string& continue_url,
91 const std::string& service);
92
93 sigslot::signal0<> SignalAuthenticationError;
94 sigslot::signal0<> SignalCertificateExpired;
95 sigslot::signal1<const std::string&> SignalFreshAuthCookie;
96
97 private:
98 void OnAuthDone(talk_base::SignalThread* worker);
99
100 void InternalStartGaiaAuth(const buzz::Jid& jid,
101 const talk_base::SocketAddress& server,
102 const talk_base::CryptString& pass,
103 const std::string& sid,
104 const std::string& service,
105 bool obtain_auth);
106
107 std::string agent_;
108 std::string signature_;
109 talk_base::ProxyInfo proxy_;
110 talk_base::FirewallManager* firewall_;
111 class WorkerThread;
112 WorkerThread* worker_;
113 bool done_;
114
115 CaptchaAnswer captcha_answer_;
116 std::string token_service_;
117 };
118
119 ///////////////////////////////////////////////////////////////////////////////
120 // Globals
121 ///////////////////////////////////////////////////////////////////////////////
122
123 extern GaiaServer g_gaia_server;
124
125 ///////////////////////////////////////////////////////////////////////////////
126
127 } // namespace buzz
128
129 #endif // CHROME_BROWSER_SYNC_NOTIFIER_GAIA_AUTH_GAIAAUTH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698