| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/gaia_token_pre_xmpp_auth.h" | 5 #include "jingle/notifier/base/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 "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 auth_mechanism_(auth_mechanism) { | 62 auth_mechanism_(auth_mechanism) { |
| 63 DCHECK(!auth_mechanism_.empty()); | 63 DCHECK(!auth_mechanism_.empty()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 GaiaTokenPreXmppAuth::~GaiaTokenPreXmppAuth() { } | 66 GaiaTokenPreXmppAuth::~GaiaTokenPreXmppAuth() { } |
| 67 | 67 |
| 68 void GaiaTokenPreXmppAuth::StartPreXmppAuth( | 68 void GaiaTokenPreXmppAuth::StartPreXmppAuth( |
| 69 const buzz::Jid& jid, | 69 const buzz::Jid& jid, |
| 70 const talk_base::SocketAddress& server, | 70 const talk_base::SocketAddress& server, |
| 71 const talk_base::CryptString& pass, | 71 const talk_base::CryptString& pass, |
| 72 const std::string& auth_cookie) { | 72 const std::string& auth_mechanism, |
| 73 const std::string& auth_token) { |
| 73 SignalAuthDone(); | 74 SignalAuthDone(); |
| 74 } | 75 } |
| 75 | 76 |
| 76 bool GaiaTokenPreXmppAuth::IsAuthDone() const { | 77 bool GaiaTokenPreXmppAuth::IsAuthDone() const { |
| 77 return true; | 78 return true; |
| 78 } | 79 } |
| 79 | 80 |
| 80 bool GaiaTokenPreXmppAuth::IsAuthorized() const { | 81 bool GaiaTokenPreXmppAuth::IsAuthorized() const { |
| 81 return true; | 82 return true; |
| 82 } | 83 } |
| 83 | 84 |
| 84 bool GaiaTokenPreXmppAuth::HadError() const { | 85 bool GaiaTokenPreXmppAuth::HadError() const { |
| 85 return false; | 86 return false; |
| 86 } | 87 } |
| 87 | 88 |
| 88 int GaiaTokenPreXmppAuth::GetError() const { | 89 int GaiaTokenPreXmppAuth::GetError() const { |
| 89 return 0; | 90 return 0; |
| 90 } | 91 } |
| 91 | 92 |
| 92 buzz::CaptchaChallenge GaiaTokenPreXmppAuth::GetCaptchaChallenge() const { | 93 buzz::CaptchaChallenge GaiaTokenPreXmppAuth::GetCaptchaChallenge() const { |
| 93 return buzz::CaptchaChallenge(); | 94 return buzz::CaptchaChallenge(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 std::string GaiaTokenPreXmppAuth::GetAuthCookie() const { | 97 std::string GaiaTokenPreXmppAuth::GetAuthToken() const { |
| 97 return std::string(); | 98 return token_; |
| 99 } |
| 100 |
| 101 std::string GaiaTokenPreXmppAuth::GetAuthMechanism() const { |
| 102 return auth_mechanism_; |
| 98 } | 103 } |
| 99 | 104 |
| 100 std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism( | 105 std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism( |
| 101 const std::vector<std::string> & mechanisms, bool encrypted) { | 106 const std::vector<std::string> & mechanisms, bool encrypted) { |
| 102 return (std::find(mechanisms.begin(), | 107 return (std::find(mechanisms.begin(), |
| 103 mechanisms.end(), auth_mechanism_) != | 108 mechanisms.end(), auth_mechanism_) != |
| 104 mechanisms.end()) ? auth_mechanism_ : ""; | 109 mechanisms.end()) ? auth_mechanism_ : ""; |
| 105 } | 110 } |
| 106 | 111 |
| 107 buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( | 112 buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( |
| 108 const std::string& mechanism) { | 113 const std::string& mechanism) { |
| 109 if (mechanism == auth_mechanism_) | 114 if (mechanism == auth_mechanism_) |
| 110 return new GaiaCookieMechanism( | 115 return new GaiaCookieMechanism( |
| 111 mechanism, username_, token_, token_service_); | 116 mechanism, username_, token_, token_service_); |
| 112 return NULL; | 117 return NULL; |
| 113 } | 118 } |
| 114 | 119 |
| 115 } // namespace notifier | 120 } // namespace notifier |
| OLD | NEW |