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

Unified Diff: remoting/jingle_glue/gaia_token_pre_xmpp_auth.cc

Issue 2843026: Fork a copy of all the notifier code in chrome/common/net/notifier that we depend on. (Closed) Base URL: git://codf21.jail.google.com/chromium.git
Patch Set: Merge in sergey's patch (2834024) and fix checkdeps 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/jingle_glue/gaia_token_pre_xmpp_auth.h ('k') | remoting/jingle_glue/jingle_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/jingle_glue/gaia_token_pre_xmpp_auth.cc
diff --git a/remoting/jingle_glue/gaia_token_pre_xmpp_auth.cc b/remoting/jingle_glue/gaia_token_pre_xmpp_auth.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0b318505ba1340cb6dbda0e3df70e0d6530ffd91
--- /dev/null
+++ b/remoting/jingle_glue/gaia_token_pre_xmpp_auth.cc
@@ -0,0 +1,76 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/jingle_glue/gaia_token_pre_xmpp_auth.h"
+
+#include <algorithm>
+
+#include "talk/base/socketaddress.h"
+#include "talk/xmpp/constants.h"
+#include "talk/xmpp/saslcookiemechanism.h"
+
+namespace remoting {
+
+namespace {
+const char kGaiaAuthMechanism[] = "X-GOOGLE-TOKEN";
+} // namespace
+
+GaiaTokenPreXmppAuth::GaiaTokenPreXmppAuth(
+ const std::string& username,
+ const std::string& token,
+ const std::string& token_service)
+ : username_(username),
+ token_(token),
+ token_service_(token_service) { }
+
+GaiaTokenPreXmppAuth::~GaiaTokenPreXmppAuth() { }
+
+void GaiaTokenPreXmppAuth::StartPreXmppAuth(
+ const buzz::Jid& jid,
+ const talk_base::SocketAddress& server,
+ const talk_base::CryptString& pass,
+ const std::string& auth_cookie) {
+ SignalAuthDone();
+}
+
+bool GaiaTokenPreXmppAuth::IsAuthDone() const {
+ return true;
+}
+
+bool GaiaTokenPreXmppAuth::IsAuthorized() const {
+ return true;
+}
+
+bool GaiaTokenPreXmppAuth::HadError() const {
+ return false;
+}
+
+int GaiaTokenPreXmppAuth::GetError() const {
+ return 0;
+}
+
+buzz::CaptchaChallenge GaiaTokenPreXmppAuth::GetCaptchaChallenge() const {
+ return buzz::CaptchaChallenge();
+}
+
+std::string GaiaTokenPreXmppAuth::GetAuthCookie() const {
+ return std::string();
+}
+
+std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism(
+ const std::vector<std::string> & mechanisms, bool encrypted) {
+ return (std::find(mechanisms.begin(),
+ mechanisms.end(), kGaiaAuthMechanism) !=
+ mechanisms.end()) ? kGaiaAuthMechanism : "";
+}
+
+buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism(
+ const std::string& mechanism) {
+ if (mechanism != kGaiaAuthMechanism)
+ return NULL;
+ return new buzz::SaslCookieMechanism(
+ kGaiaAuthMechanism, username_, token_, token_service_);
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/jingle_glue/gaia_token_pre_xmpp_auth.h ('k') | remoting/jingle_glue/jingle_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698