2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef WEBRTC_LIBJINGLE_XMPP_XMPPAUTH_H_
12 #define WEBRTC_LIBJINGLE_XMPP_XMPPAUTH_H_
16 #include "webrtc/libjingle/xmpp/jid.h"
17 #include "webrtc/libjingle/xmpp/prexmppauth.h"
18 #include "webrtc/libjingle/xmpp/saslhandler.h"
19 #include "webrtc/base/cryptstring.h"
20 #include "webrtc/base/sigslot.h"
22 class XmppAuth: public buzz::PreXmppAuth {
27 // TODO: Just have one "secret" that is either pass or
29 virtual void StartPreXmppAuth(const buzz::Jid& jid,
30 const rtc::SocketAddress& server,
31 const rtc::CryptString& pass,
32 const std::string& auth_mechanism,
33 const std::string& auth_token);
35 virtual bool IsAuthDone() const { return done_; }
36 virtual bool IsAuthorized() const { return true; }
37 virtual bool HadError() const { return false; }
38 virtual int GetError() const { return 0; }
39 virtual buzz::CaptchaChallenge GetCaptchaChallenge() const {
40 return buzz::CaptchaChallenge();
42 virtual std::string GetAuthMechanism() const { return auth_mechanism_; }
43 virtual std::string GetAuthToken() const { return auth_token_; }
45 virtual std::string ChooseBestSaslMechanism(
46 const std::vector<std::string>& mechanisms,
49 virtual buzz::SaslMechanism * CreateSaslMechanism(
50 const std::string& mechanism);
54 rtc::CryptString passwd_;
55 std::string auth_mechanism_;
56 std::string auth_token_;
60 #endif // WEBRTC_LIBJINGLE_XMPP_XMPPAUTH_H_