Chromium Code Reviews| Index: jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc |
| =================================================================== |
| --- jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc (revision 77157) |
| +++ jingle/notifier/communicator/gaia_token_pre_xmpp_auth.cc (working copy) |
| @@ -52,10 +52,17 @@ |
| GaiaTokenPreXmppAuth::GaiaTokenPreXmppAuth( |
| const std::string& username, |
| const std::string& token, |
| - const std::string& token_service) |
| + const std::string& token_service, |
| + const std::string& auth_mechanism) |
| : username_(username), |
| token_(token), |
| - token_service_(token_service) { } |
| + token_service_(token_service), |
| + auth_mechanism_(auth_mechanism) { |
| + // 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.
|
| + // is not specified. |
| + if (auth_mechanism_.empty()) |
| + auth_mechanism_ = kGaiaAuthMechanism; |
| +} |
| GaiaTokenPreXmppAuth::~GaiaTokenPreXmppAuth() { } |
| @@ -94,16 +101,16 @@ |
| std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism( |
| const std::vector<std::string> & mechanisms, bool encrypted) { |
| return (std::find(mechanisms.begin(), |
| - mechanisms.end(), kGaiaAuthMechanism) != |
| - mechanisms.end()) ? kGaiaAuthMechanism : ""; |
| + mechanisms.end(), auth_mechanism_) != |
| + mechanisms.end()) ? auth_mechanism_ : ""; |
| } |
| buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( |
| const std::string& mechanism) { |
| - if (mechanism != kGaiaAuthMechanism) |
| - return NULL; |
| - return new GaiaCookieMechanism( |
| - kGaiaAuthMechanism, username_, token_, token_service_); |
| + if (mechanism == auth_mechanism_) |
| + return new GaiaCookieMechanism( |
| + mechanism, username_, token_, token_service_); |
| + return NULL; |
| } |
| } // namespace notifier |