diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 01:32:30 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 01:32:30 +0000 |
commit | 690368961bc9fd8214b8e9b57b7bd0b70b98e951 (patch) | |
tree | f0e7a997755cc312c8846fd45a9125f1ca9743c2 /jingle | |
parent | 1f9daa69aef67b05cf46c56a1e34588a5a5e2ba0 (diff) | |
download | chromium_src-690368961bc9fd8214b8e9b57b7bd0b70b98e951.zip chromium_src-690368961bc9fd8214b8e9b57b7bd0b70b98e951.tar.gz chromium_src-690368961bc9fd8214b8e9b57b7bd0b70b98e951.tar.bz2 |
Fixed bug where sync notifications don't work for non-gmail accounts.
BUG=48988
TEST=manual
Review URL: http://codereview.chromium.org/2981010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc b/jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc index bcc6f04..a10900d 100644 --- a/jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc +++ b/jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "base/basictypes.h" #include "talk/base/socketaddress.h" #include "talk/xmpp/constants.h" #include "talk/xmpp/saslcookiemechanism.h" @@ -13,7 +14,39 @@ namespace notifier { namespace { + const char kGaiaAuthMechanism[] = "X-GOOGLE-TOKEN"; + +class GaiaCookieMechanism : public buzz::SaslCookieMechanism { + public: + GaiaCookieMechanism(const std::string & mechanism, + const std::string & username, + const std::string & cookie, + const std::string & token_service) + : buzz::SaslCookieMechanism( + mechanism, username, cookie, token_service) {} + + virtual ~GaiaCookieMechanism() {} + + virtual buzz::XmlElement* StartSaslAuth() { + buzz::XmlElement* auth = buzz::SaslCookieMechanism::StartSaslAuth(); + // These attributes are necessary for working with non-gmail gaia + // accounts. + const std::string NS_GOOGLE_AUTH_PROTOCOL( + "http://www.google.com/talk/protocol/auth"); + const buzz::QName QN_GOOGLE_ALLOW_GENERATED_JID_XMPP_LOGIN( + true, NS_GOOGLE_AUTH_PROTOCOL, "allow-generated-jid"); + const buzz::QName QN_GOOGLE_AUTH_CLIENT_USES_FULL_BIND_RESULT( + true, NS_GOOGLE_AUTH_PROTOCOL, "client-uses-full-bind-result"); + auth->SetAttr(QN_GOOGLE_ALLOW_GENERATED_JID_XMPP_LOGIN, "true"); + auth->SetAttr(QN_GOOGLE_AUTH_CLIENT_USES_FULL_BIND_RESULT, "true"); + return auth; + } + + private: + DISALLOW_COPY_AND_ASSIGN(GaiaCookieMechanism); +}; + } // namespace GaiaTokenPreXmppAuth::GaiaTokenPreXmppAuth( @@ -69,7 +102,7 @@ buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( const std::string& mechanism) { if (mechanism != kGaiaAuthMechanism) return NULL; - return new buzz::SaslCookieMechanism( + return new GaiaCookieMechanism( kGaiaAuthMechanism, username_, token_, token_service_); } |