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

Side by Side Diff: chrome/common/net/notifier/communicator/gaia_token_pre_xmpp_auth.cc

Issue 2724010: Revert 49298 - Broke compile - Token-based authentication for chromoting.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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
(Empty)
1 // Copyright (c) 2010 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 #include "chrome/common/net/notifier/communicator/gaia_token_pre_xmpp_auth.h"
6
7 #include "talk/base/socketaddress.h"
8 #include "talk/xmpp/constants.h"
9 #include "talk/xmpp/saslcookiemechanism.h"
10
11 namespace notifier {
12
13 namespace {
14 const char kGaiaAuthMechanism[] = "X-GOOGLE-TOKEN";
15 } // namespace
16
17 GaiaTokenPreXmppAuth::GaiaTokenPreXmppAuth(
18 const std::string& username,
19 const std::string& token,
20 const std::string& token_service)
21 : username_(username),
22 token_(token),
23 token_service_(token_service) { }
24
25 GaiaTokenPreXmppAuth::~GaiaTokenPreXmppAuth() { }
26
27 void GaiaTokenPreXmppAuth::StartPreXmppAuth(
28 const buzz::Jid& jid,
29 const talk_base::SocketAddress& server,
30 const talk_base::CryptString& pass,
31 const std::string& auth_cookie) {
32 SignalAuthDone();
33 }
34
35 bool GaiaTokenPreXmppAuth::IsAuthDone() const {
36 return true;
37 }
38
39 bool GaiaTokenPreXmppAuth::IsAuthorized() const {
40 return true;
41 }
42
43 bool GaiaTokenPreXmppAuth::HadError() const {
44 return false;
45 }
46
47 int GaiaTokenPreXmppAuth::GetError() const {
48 return 0;
49 }
50
51 buzz::CaptchaChallenge GaiaTokenPreXmppAuth::GetCaptchaChallenge() const {
52 return buzz::CaptchaChallenge();
53 }
54
55 std::string GaiaTokenPreXmppAuth::GetAuthCookie() const {
56 return std::string();
57 }
58
59 std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism(
60 const std::vector<std::string> & mechanisms, bool encrypted) {
61 return (std::find(mechanisms.begin(),
62 mechanisms.end(), kGaiaAuthMechanism) !=
63 mechanisms.end()) ? kGaiaAuthMechanism : "";
64 }
65
66 buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism(
67 const std::string& mechanism) {
68 if (mechanism != kGaiaAuthMechanism)
69 return NULL;
70 return new buzz::SaslCookieMechanism(
71 kGaiaAuthMechanism, username_, token_, token_service_);
72 }
73
74 } // namespace notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698