OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_COMMON_NET_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ |
| 6 #define CHROME_COMMON_NET_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "talk/xmpp/prexmppauth.h" |
| 12 |
| 13 namespace notifier { |
| 14 |
| 15 // This class implements buzz::PreXmppAuth interface for token-based |
| 16 // authentication in GTalk. It looks for the X-GOOGLE-TOKEN auth mechanism |
| 17 // and uses that instead of the default auth mechanism (PLAIN). |
| 18 class GaiaTokenPreXmppAuth : public buzz::PreXmppAuth { |
| 19 public: |
| 20 GaiaTokenPreXmppAuth(const std::string& username, const std::string& token, |
| 21 const std::string& token_service); |
| 22 |
| 23 virtual ~GaiaTokenPreXmppAuth(); |
| 24 |
| 25 // buzz::PreXmppAuth (-buzz::SaslHandler) implementation. We stub |
| 26 // all the methods out as we don't actually do any authentication at |
| 27 // this point. |
| 28 virtual void StartPreXmppAuth(const buzz::Jid& jid, |
| 29 const talk_base::SocketAddress& server, |
| 30 const talk_base::CryptString& pass, |
| 31 const std::string& auth_cookie); |
| 32 |
| 33 virtual bool IsAuthDone() const; |
| 34 |
| 35 virtual bool IsAuthorized() const; |
| 36 |
| 37 virtual bool HadError() const; |
| 38 |
| 39 virtual int GetError() const; |
| 40 |
| 41 virtual buzz::CaptchaChallenge GetCaptchaChallenge() const; |
| 42 |
| 43 virtual std::string GetAuthCookie() const; |
| 44 |
| 45 // buzz::SaslHandler implementation. |
| 46 |
| 47 virtual std::string ChooseBestSaslMechanism( |
| 48 const std::vector<std::string>& mechanisms, bool encrypted); |
| 49 |
| 50 virtual buzz::SaslMechanism* CreateSaslMechanism( |
| 51 const std::string& mechanism); |
| 52 |
| 53 private: |
| 54 std::string username_; |
| 55 std::string token_; |
| 56 std::string token_service_; |
| 57 }; |
| 58 |
| 59 } // namespace notifier |
| 60 |
| 61 #endif // CHROME_COMMON_NET_NOTIFIER_COMMUNICATOR_GAIA_TOKEN_PRE_XMPP_AUTH_H_ |
OLD | NEW |