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