OLD | NEW |
(Empty) | |
| 1 // Copyright 2004 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 WEBRTC_LIBJINGLE_XMPP_XMPPAUTH_H_ |
| 6 #define WEBRTC_LIBJINGLE_XMPP_XMPPAUTH_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "third_party/libjingle_xmpp/xmpp/jid.h" |
| 11 #include "third_party/libjingle_xmpp/xmpp/prexmppauth.h" |
| 12 #include "third_party/libjingle_xmpp/xmpp/saslhandler.h" |
| 13 #include "webrtc/base/cryptstring.h" |
| 14 #include "webrtc/base/sigslot.h" |
| 15 |
| 16 class XmppAuth: public buzz::PreXmppAuth { |
| 17 public: |
| 18 XmppAuth(); |
| 19 virtual ~XmppAuth(); |
| 20 |
| 21 // TODO: Just have one "secret" that is either pass or |
| 22 // token? |
| 23 virtual void StartPreXmppAuth(const buzz::Jid& jid, |
| 24 const rtc::SocketAddress& server, |
| 25 const rtc::CryptString& pass, |
| 26 const std::string& auth_mechanism, |
| 27 const std::string& auth_token); |
| 28 |
| 29 virtual bool IsAuthDone() const { return done_; } |
| 30 virtual bool IsAuthorized() const { return true; } |
| 31 virtual bool HadError() const { return false; } |
| 32 virtual int GetError() const { return 0; } |
| 33 virtual buzz::CaptchaChallenge GetCaptchaChallenge() const { |
| 34 return buzz::CaptchaChallenge(); |
| 35 } |
| 36 virtual std::string GetAuthMechanism() const { return auth_mechanism_; } |
| 37 virtual std::string GetAuthToken() const { return auth_token_; } |
| 38 |
| 39 virtual std::string ChooseBestSaslMechanism( |
| 40 const std::vector<std::string>& mechanisms, |
| 41 bool encrypted); |
| 42 |
| 43 virtual buzz::SaslMechanism * CreateSaslMechanism( |
| 44 const std::string& mechanism); |
| 45 |
| 46 private: |
| 47 buzz::Jid jid_; |
| 48 rtc::CryptString passwd_; |
| 49 std::string auth_mechanism_; |
| 50 std::string auth_token_; |
| 51 bool done_; |
| 52 }; |
| 53 |
| 54 #endif // WEBRTC_LIBJINGLE_XMPP_XMPPAUTH_H_ |
| 55 |
OLD | NEW |