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

Side by Side Diff: jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc

Issue 6649006: Added support for other authentication mechanisms in jingle. This will allow ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Lint error fixed Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 #include "jingle/notifier/communicator/gaia_token_pre_xmpp_auth.h" 5 #include "jingle/notifier/communicator/gaia_token_pre_xmpp_auth.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "talk/base/socketaddress.h" 10 #include "talk/base/socketaddress.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 private: 46 private:
47 DISALLOW_COPY_AND_ASSIGN(GaiaCookieMechanism); 47 DISALLOW_COPY_AND_ASSIGN(GaiaCookieMechanism);
48 }; 48 };
49 49
50 } // namespace 50 } // namespace
51 51
52 GaiaTokenPreXmppAuth::GaiaTokenPreXmppAuth( 52 GaiaTokenPreXmppAuth::GaiaTokenPreXmppAuth(
53 const std::string& username, 53 const std::string& username,
54 const std::string& token, 54 const std::string& token,
55 const std::string& token_service) 55 const std::string& token_service,
56 const std::string& auth_mechanism)
56 : username_(username), 57 : username_(username),
57 token_(token), 58 token_(token),
58 token_service_(token_service) { } 59 token_service_(token_service),
60 auth_mechanism_(auth_mechanism) {
61 // For backward compatibility, default to kGaiaAuthMechanism if a mechanism
akalin 2011/03/08 23:45:56 Hmm, I'd rather expose the default gaia auth mecha
sanjeevr 2011/03/09 00:54:44 Done.
62 // is not specified.
63 if (auth_mechanism_.empty())
64 auth_mechanism_ = kGaiaAuthMechanism;
65 }
59 66
60 GaiaTokenPreXmppAuth::~GaiaTokenPreXmppAuth() { } 67 GaiaTokenPreXmppAuth::~GaiaTokenPreXmppAuth() { }
61 68
62 void GaiaTokenPreXmppAuth::StartPreXmppAuth( 69 void GaiaTokenPreXmppAuth::StartPreXmppAuth(
63 const buzz::Jid& jid, 70 const buzz::Jid& jid,
64 const talk_base::SocketAddress& server, 71 const talk_base::SocketAddress& server,
65 const talk_base::CryptString& pass, 72 const talk_base::CryptString& pass,
66 const std::string& auth_cookie) { 73 const std::string& auth_cookie) {
67 SignalAuthDone(); 74 SignalAuthDone();
68 } 75 }
(...skipping 18 matching lines...) Expand all
87 return buzz::CaptchaChallenge(); 94 return buzz::CaptchaChallenge();
88 } 95 }
89 96
90 std::string GaiaTokenPreXmppAuth::GetAuthCookie() const { 97 std::string GaiaTokenPreXmppAuth::GetAuthCookie() const {
91 return std::string(); 98 return std::string();
92 } 99 }
93 100
94 std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism( 101 std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism(
95 const std::vector<std::string> & mechanisms, bool encrypted) { 102 const std::vector<std::string> & mechanisms, bool encrypted) {
96 return (std::find(mechanisms.begin(), 103 return (std::find(mechanisms.begin(),
97 mechanisms.end(), kGaiaAuthMechanism) != 104 mechanisms.end(), auth_mechanism_) !=
98 mechanisms.end()) ? kGaiaAuthMechanism : ""; 105 mechanisms.end()) ? auth_mechanism_ : "";
99 } 106 }
100 107
101 buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( 108 buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism(
102 const std::string& mechanism) { 109 const std::string& mechanism) {
103 if (mechanism != kGaiaAuthMechanism) 110 if (mechanism == auth_mechanism_)
104 return NULL; 111 return new GaiaCookieMechanism(
105 return new GaiaCookieMechanism( 112 mechanism, username_, token_, token_service_);
106 kGaiaAuthMechanism, username_, token_, token_service_); 113 return NULL;
107 } 114 }
108 115
109 } // namespace notifier 116 } // namespace notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698