| OLD | NEW |
| 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 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ | 5 #ifndef JINGLE_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ |
| 6 #define JINGLE_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ | 6 #define JINGLE_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "talk/xmpp/prexmppauth.h" | 11 #include "talk/xmpp/prexmppauth.h" |
| 12 | 12 |
| 13 namespace notifier { | 13 namespace notifier { |
| 14 | 14 |
| 15 // This class implements buzz::PreXmppAuth interface for token-based | 15 // This class implements buzz::PreXmppAuth interface for token-based |
| 16 // authentication in GTalk. It looks for the X-GOOGLE-TOKEN auth mechanism | 16 // authentication in GTalk. It looks for the X-GOOGLE-TOKEN auth mechanism |
| 17 // and uses that instead of the default auth mechanism (PLAIN). | 17 // and uses that instead of the default auth mechanism (PLAIN). |
| 18 class GaiaTokenPreXmppAuth : public buzz::PreXmppAuth { | 18 class GaiaTokenPreXmppAuth : public buzz::PreXmppAuth { |
| 19 public: | 19 public: |
| 20 GaiaTokenPreXmppAuth(const std::string& username, const std::string& token, | 20 GaiaTokenPreXmppAuth(const std::string& username, const std::string& token, |
| 21 const std::string& token_service); | 21 const std::string& token_service, |
| 22 const std::string& auth_mechanism); |
| 22 | 23 |
| 23 virtual ~GaiaTokenPreXmppAuth(); | 24 virtual ~GaiaTokenPreXmppAuth(); |
| 24 | 25 |
| 25 // buzz::PreXmppAuth (-buzz::SaslHandler) implementation. We stub | 26 // buzz::PreXmppAuth (-buzz::SaslHandler) implementation. We stub |
| 26 // all the methods out as we don't actually do any authentication at | 27 // all the methods out as we don't actually do any authentication at |
| 27 // this point. | 28 // this point. |
| 28 virtual void StartPreXmppAuth(const buzz::Jid& jid, | 29 virtual void StartPreXmppAuth(const buzz::Jid& jid, |
| 29 const talk_base::SocketAddress& server, | 30 const talk_base::SocketAddress& server, |
| 30 const talk_base::CryptString& pass, | 31 const talk_base::CryptString& pass, |
| 31 const std::string& auth_cookie); | 32 const std::string& auth_cookie); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 43 virtual std::string GetAuthCookie() const; | 44 virtual std::string GetAuthCookie() const; |
| 44 | 45 |
| 45 // buzz::SaslHandler implementation. | 46 // buzz::SaslHandler implementation. |
| 46 | 47 |
| 47 virtual std::string ChooseBestSaslMechanism( | 48 virtual std::string ChooseBestSaslMechanism( |
| 48 const std::vector<std::string>& mechanisms, bool encrypted); | 49 const std::vector<std::string>& mechanisms, bool encrypted); |
| 49 | 50 |
| 50 virtual buzz::SaslMechanism* CreateSaslMechanism( | 51 virtual buzz::SaslMechanism* CreateSaslMechanism( |
| 51 const std::string& mechanism); | 52 const std::string& mechanism); |
| 52 | 53 |
| 54 static const char kDefaultAuthMechanism[]; |
| 55 |
| 53 private: | 56 private: |
| 54 std::string username_; | 57 std::string username_; |
| 55 std::string token_; | 58 std::string token_; |
| 56 std::string token_service_; | 59 std::string token_service_; |
| 60 std::string auth_mechanism_; |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 } // namespace notifier | 63 } // namespace notifier |
| 60 | 64 |
| 61 #endif // JINGLE_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ | 65 #endif // JINGLE_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ |
| OLD | NEW |