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_PREXMPPAUTH_H_ |
| 6 #define WEBRTC_LIBJINGLE_XMPP_PREXMPPAUTH_H_ |
| 7 |
| 8 #include "third_party/libjingle_xmpp/xmpp/saslhandler.h" |
| 9 #include "webrtc/base/cryptstring.h" |
| 10 #include "webrtc/base/sigslot.h" |
| 11 |
| 12 namespace rtc { |
| 13 class SocketAddress; |
| 14 } |
| 15 |
| 16 namespace buzz { |
| 17 |
| 18 class Jid; |
| 19 class SaslMechanism; |
| 20 |
| 21 class CaptchaChallenge { |
| 22 public: |
| 23 CaptchaChallenge() : captcha_needed_(false) {} |
| 24 CaptchaChallenge(const std::string& token, const std::string& url) |
| 25 : captcha_needed_(true), captcha_token_(token), captcha_image_url_(url) { |
| 26 } |
| 27 |
| 28 bool captcha_needed() const { return captcha_needed_; } |
| 29 const std::string& captcha_token() const { return captcha_token_; } |
| 30 |
| 31 // This url is relative to the gaia server. Once we have better tools |
| 32 // for cracking URLs, we should probably make this a full URL |
| 33 const std::string& captcha_image_url() const { return captcha_image_url_; } |
| 34 |
| 35 private: |
| 36 bool captcha_needed_; |
| 37 std::string captcha_token_; |
| 38 std::string captcha_image_url_; |
| 39 }; |
| 40 |
| 41 class PreXmppAuth : public SaslHandler { |
| 42 public: |
| 43 virtual ~PreXmppAuth() {} |
| 44 |
| 45 virtual void StartPreXmppAuth( |
| 46 const Jid& jid, |
| 47 const rtc::SocketAddress& server, |
| 48 const rtc::CryptString& pass, |
| 49 const std::string& auth_mechanism, |
| 50 const std::string& auth_token) = 0; |
| 51 |
| 52 sigslot::signal0<> SignalAuthDone; |
| 53 |
| 54 virtual bool IsAuthDone() const = 0; |
| 55 virtual bool IsAuthorized() const = 0; |
| 56 virtual bool HadError() const = 0; |
| 57 virtual int GetError() const = 0; |
| 58 virtual CaptchaChallenge GetCaptchaChallenge() const = 0; |
| 59 virtual std::string GetAuthMechanism() const = 0; |
| 60 virtual std::string GetAuthToken() const = 0; |
| 61 }; |
| 62 |
| 63 } |
| 64 |
| 65 #endif // WEBRTC_LIBJINGLE_XMPP_PREXMPPAUTH_H_ |
OLD | NEW |